cocos2dx 制作单机麻将(五)

麻将逻辑6 最基础的4人麻将逻辑(轮流循环出牌, 之前学的都能用上  跑起来了!!!)

最基础的麻将逻辑

依据自己须要 设置麻将人数GAME_PLAYER

基本流程:

初始化牌堆,

推断庄家

玩家0摸13张牌

玩家1摸13张牌

玩家2摸13张牌

玩家3摸13张牌

庄家摸一张牌

庄家出牌

闲家摸牌

闲家出牌

闲家摸牌

闲家出牌

闲家摸牌

闲家出牌

庄家摸一张牌

庄家出牌

闲家摸牌

闲家出牌

.......

牌堆数为0 结束

其它功能 比方
碰吃杠听胡等等 先不实现

代码不难,非常easy看懂

//
// main.cpp
// MajiangLogicTest
//
// Created by TinyUlt on 14-8-16.
// Copyright (c) 2014年 TinyUlt. All rights reserved.
//
/*
最基础的麻将逻辑 其它功能 比方 碰吃杠听胡等等 先不实现 */
#include <iostream>
using namespace std; #define MAX_REPERTORY 144
typedef unsigned char BYTE;
typedef unsigned short WORD;
//数组维数
#ifndef CountArray
#define CountArray(Array) (sizeof(Array)/sizeof(Array[0]))
#endif
//逻辑掩码 #define MASK_COLOR 0xF0 //花色掩码
#define MASK_VALUE 0x0F //数值掩码
#define MAX_INDEX 42 //最大索引
#define MAX_COUNT 14 //最大数目
#define GAME_PLAYER 4 //游戏人数 const BYTE m_cbCardDataArray[MAX_REPERTORY]=
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, //万子
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, //万子
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, //万子
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, //万子
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19, //同子
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19, //同子
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19, //同子
0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19, //同子
0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, //索子
0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, //索子
0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, //索子
0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, //索子 0x31,0x32,0x33,0x34, //风牌
0x31,0x32,0x33,0x34, //风牌
0x31,0x32,0x33,0x34, //风牌
0x31,0x32,0x33,0x34, //风牌
0x41,0x42,0x43, //箭牌
0x41,0x42,0x43, //箭牌
0x41,0x42,0x43, //箭牌
0x41,0x42,0x43, //箭牌 0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58, //花牌 };
const char* m_cbCardWordArray[MAX_INDEX]=
{
"一万","二万","三万","四万","五万","六万","七万","八万","九万",
"一筒","二筒","三筒","四筒","五筒","六筒","七筒","八筒","九筒",
"一索","二索","三索","四索","五索","六索","七索","八索","九索",
"东", "南", "西", "北", "中", "发", "白",
"春", "夏", "秋", "冬", "梅", "兰", "竹", "菊"
};
//混乱扑克
static void RandCardData(BYTE cbCardData[],BYTE cbMaxCount)
{
//混乱准备
BYTE cbCardDataTemp[CountArray(m_cbCardDataArray)];//为什么直接用MAX_REPERTORY? 由于这样无耦合
memcpy(cbCardDataTemp,m_cbCardDataArray,sizeof(m_cbCardDataArray));//拷贝一份到暂时牌数组中 //混乱扑克(关键的核心打乱代码)
BYTE cbRandCount=0,cbPosition=0;
do
{
cbPosition=rand()%(cbMaxCount-cbRandCount);
cbCardData[cbRandCount++]=cbCardDataTemp[cbPosition];
cbCardDataTemp[cbPosition]=cbCardDataTemp[cbMaxCount-cbRandCount];
} while (cbRandCount<cbMaxCount); return; }
//混乱扑克2
void RandAppointCardData(BYTE cbCardData[],BYTE cbMaxCount,BYTE OriginalData[]/*源牌堆数据*/)
{
//混乱扑克
BYTE cbRandCount=0,cbPosition=0;
do
{
cbPosition=rand()%(cbMaxCount-cbRandCount);
cbCardData[cbRandCount++]=OriginalData[cbPosition];
OriginalData[cbPosition]=OriginalData[cbMaxCount-cbRandCount];
} while (cbRandCount<cbMaxCount); return;
}
//扑克转换(索引->牌值)
BYTE SwitchToCardData(BYTE cbCardIndex)
{
//assert(cbCardIndex<42);
if(cbCardIndex<31) return ((cbCardIndex/9)<<4)|(cbCardIndex%9+1);
if(cbCardIndex>=31&&cbCardIndex<=33) return(((cbCardIndex/7)<<4)+cbCardIndex%10 );
if(cbCardIndex>33) return(cbCardIndex+0x2F);
//assert(false);
return 0;
}
//扑克转换(牌型->索引)
BYTE SwitchToCardIndex(BYTE cbCardData)
{
// ASSERT(IsValidCard(cbCardData));
if((cbCardData&MASK_COLOR)<=0x30)
return (((cbCardData&MASK_COLOR)>>4)*9+(cbCardData&MASK_VALUE)-1);
if((cbCardData&MASK_COLOR)==0x40)
return (31+(cbCardData&MASK_VALUE)-1);
if((cbCardData&MASK_COLOR)==0x50)
return (34+(cbCardData&MASK_VALUE)-1);
//ASSERT(false);
return 0;
} //扑克转换
BYTE SwitchToCardData(BYTE cbCardIndex[MAX_INDEX]/*传入统计全部牌数量的表格*/, BYTE cbCardData[MAX_COUNT]/*传出手牌数据*/)
{
//转换扑克
BYTE cbPosition=0;
for (BYTE i=0;i<MAX_INDEX;i++)
{
if (cbCardIndex[i]!=0)
{
for (BYTE j=0;j<cbCardIndex[i];j++)
{
// ASSERT(cbPosition<MAX_COUNT);
cbCardData[cbPosition++]=SwitchToCardData(i);
}
}
} return cbPosition;//返回手牌数
}
//依据中文牌,得到牌索引
int getIndexByWord(const char* ch)
{
for (int i = 0; i < MAX_INDEX; i++)
{
if (!strcmp(ch,m_cbCardWordArray[i]))
{
return i;
}
}
return -1;
}
//删除扑克
bool RemoveCard(BYTE cbCardIndex[MAX_INDEX], BYTE cbRemoveCard)
{ //效验扑克
//ASSERT(IsValidCard(cbRemoveCard));
BYTE cbRemoveIndex=SwitchToCardIndex(cbRemoveCard);
//ASSERT(cbCardIndex[cbRemoveIndex]>0); //删除扑克
if (cbCardIndex[cbRemoveIndex]>0)
{
cbCardIndex[cbRemoveIndex]--;
return true;
} //失败效验
// ASSERT(FALSE); return false;
}
int changePlayer(int id)
{
id += 1;
if (id>=GAME_PLAYER) {
id = 0;
} return id;
}
int main(int argc, const char * argv[])
{
// insert code here... //创建一个空牌堆
BYTE _cardPile[MAX_REPERTORY];
//庄家用户索引
BYTE _bankerId = rand()%GAME_PLAYER;
//玩家的手牌表格
BYTE _playerIndex[GAME_PLAYER][MAX_INDEX];
//当前牌堆取牌索引
BYTE _currentInde = 0;
//出牌的次数
BYTE _outCardTime = 0; /*第一种混乱发*/
//得到牌堆数据
RandCardData(_cardPile, MAX_REPERTORY);
//输出牌堆数据
cout<<"混乱初始牌堆"<<endl; for (int i = 0 ; i < MAX_REPERTORY; i++)
{
cout<<hex<<"0x"<<int(_cardPile[i])<<" ";
}
cout<<endl<<endl; //初始化玩家的牌数据
for (int i = 0; i < GAME_PLAYER; i++)
{
for ( ; _currentInde < (MAX_COUNT-1)*(i+1); _currentInde++)
{
BYTE _cardValue = _cardPile[_currentInde];//得到牌堆中的牌
int _index = SwitchToCardIndex(_cardValue);//得到该牌相应的索引
_playerIndex[i][_index]++;//该牌型加一
}
}
cout<<"-----------------------------------"<<endl; for (int j = 0; j< GAME_PLAYER; j++)
{
cout<<"玩家"<<j<<"的牌数据:"<<endl;
for (int i = 0; i< MAX_INDEX; i++)
{
cout<<hex<<m_cbCardWordArray[i]<<"(0x"<<int(SwitchToCardData(i))<<"):"<<dec<<(int)_playerIndex[j][i]<<" ";//输出手牌中全部牌型相应的数量
}
cout<<endl<<endl;
}
cout<<"-----------------------------------"<<endl; for (int j = 0; j< GAME_PLAYER; j++)
{
cout<<"玩家"<<j<<"的手牌:"<<endl; BYTE _handCardData[MAX_COUNT];
int _handandsCount = (int)SwitchToCardData(_playerIndex[j],_handCardData); for (int i = 0; i< _handandsCount; i++)
{
cout<<m_cbCardWordArray[SwitchToCardIndex(_handCardData[i])]<<"(0x"<<hex<<(int)_handCardData[i]<<") ";
}
cout<<endl<<endl;
}
cout<<"-----------------------------------"<<endl; //初始化工作做好后, 開始麻将的出牌逻辑循环 cout<<"庄家: 玩家"<<(int)_bankerId<<endl;
int _currentPlayer = _bankerId; while (_currentInde < MAX_REPERTORY)
{
//出牌次数
cout<<"共出牌次数:"<<dec<<(int)_outCardTime<<endl; //准备出牌的玩家先从牌堆中取牌
BYTE _cardValue = _cardPile[_currentInde++];//得到牌堆中的牌
int _index = SwitchToCardIndex(_cardValue);//得到该牌相应的索引
_playerIndex[_currentPlayer][_index]++;//该牌型加一
cout<<"从牌堆中取牌:"<<m_cbCardWordArray[SwitchToCardIndex(_cardValue)]<<endl;
cout<<"牌堆剩余:"<<dec<<MAX_REPERTORY-_currentInde<<endl; //显示手牌
{
BYTE _handCardData[MAX_COUNT];
int _handandsCount = (int)SwitchToCardData(_playerIndex[_currentPlayer],_handCardData);
cout<<"玩家"<<_currentPlayer<<"的手牌有"<<dec<<_handandsCount<<"张:"<<endl;
for (int i = 0; i< _handandsCount; i++)
{
cout<<m_cbCardWordArray[SwitchToCardIndex(_handCardData[i])]<<"(0x"<<hex<<(int)_handCardData[i]<<") ";
}
cout<<endl;
} //输入要出的牌
recin:
char ch[20];
cout<<"玩家"<<_currentPlayer<<"要出的牌(比方 三万): ";
cin>>ch;
int _outCardIndex = getIndexByWord(ch);
if (_outCardIndex == -1)
{
cout<<"输入错误,请又一次输入"<<endl;
goto recin;
} //依据索引得到麻将牌型值
BYTE _outCardValue = SwitchToCardData(_outCardIndex); //依据牌型值删除手中的牌
bool _b = RemoveCard(_playerIndex[_currentPlayer], _outCardValue);
if (_b)
{
cout<<"出牌成功,轮到下家"<<endl;
_outCardTime++;
}
else
{
cout<<"输入错误,请又一次输入"<<endl;
goto recin;
} //显示手牌
{
BYTE _handCardData[MAX_COUNT];
int _handandsCount = (int)SwitchToCardData(_playerIndex[_currentPlayer],_handCardData);
cout<<"出牌后玩家"<<_currentPlayer<<"的手牌有"<<dec<<_handandsCount<<"张:"<<endl;
for (int i = 0; i< _handandsCount; i++)
{
cout<<m_cbCardWordArray[SwitchToCardIndex(_handCardData[i])]<<"(0x"<<hex<<(int)_handCardData[i]<<") ";
}
cout<<endl;
} cout<<"-----------------------------------"<<endl;
_currentPlayer = changePlayer(_currentPlayer);
}
return 0;
}

输出:

混乱初始牌堆

0x28 0x19 0x42 0x25 0x43 0x31 0x33 0x6 0x32 0x11 0x12 0x24 0x13 0x34 0x5 0x2 0x9 0x32 0x2 0x19 0x43 0x21 0x15 0x21 0x24 0x26 0x42 0x19 0x5 0x43 0x57 0x5 0x23 0x51 0x41 0x23 0x22 0x18 0x7 0x58 0x8 0x54 0x21 0x15 0x56 0x23 0x14 0x24 0x25
0x4 0x26 0x31 0x55 0x6 0x16 0x11 0x16 0x7 0x8 0x29 0x18 0x26 0x41 0x32 0x34 0x21 0x11 0x4 0x28 0x29 0x52 0x23 0x18 0x22 0x12 0x9 0x53 0x9 0x6 0x29 0x19 0x1 0x2 0x25 0x9 0x8 0x5 0x4 0x42 0x32 0x16 0x1 0x24 0x33 0x22 0x14 0x27 0x1 0x25 0x17 0x2 0x16 0x34 0x7
0x17 0x34 0x33 0x41 0x13 0x28 0x7 0x14 0x13 0x14 0x6 0x27 0x4 0x3 0x33 0x41 0x43 0x26 0x11 0x15 0x27 0x3 0x3 0x3 0x1 0x17 0x12 0x22 0x42 0x8 0x18 0x29 0x31 0x15 0x31 0x27 0x13 0x12 0x17 0x28 

-----------------------------------

玩家0的牌数据:

一万(0x1):0
二万(0x2):0 三万(0x3):0四万(0x4):0五万(0x5):0六万(0x6):1七万(0x7):0八万(0x8):0九万(0x9):0一筒(0x11):1二筒(0x12):1三筒(0x13):1四筒(0x14):0五筒(0x15):0六筒(0x16):0七筒(0x17):0八筒(0x18):0九筒(0x19):1一索(0x21):0二索(0x22):0三索(0x23):0四索(0x24):1五索(0x25):1六索(0x26):0七索(0x27):0八索(0x28):1九索(0x29):0(0x31):1(0x32):1西(0x33):1(0x34):0(0x41):0(0x42):1(0x43):1(0x51):0(0x52):0(0x53):0(0x54):0(0x55):0(0x56):0(0x57):0(0x58):0 

玩家1的牌数据:

一万(0x1):0
二万(0x2):2 三万(0x3):0四万(0x4):0五万(0x5):1六万(0x6):0七万(0x7):0八万(0x8):0九万(0x9):1一筒(0x11):0二筒(0x12):0三筒(0x13):0四筒(0x14):0五筒(0x15):1六筒(0x16):0七筒(0x17):0八筒(0x18):0九筒(0x19):1一索(0x21):2二索(0x22):0三索(0x23):0四索(0x24):1五索(0x25):0六索(0x26):1七索(0x27):0八索(0x28):0九索(0x29):0(0x31):0(0x32):1西(0x33):0(0x34):1(0x41):0(0x42):0(0x43):1(0x51):0(0x52):0(0x53):0(0x54):0(0x55):0(0x56):0(0x57):0(0x58):0 

玩家2的牌数据:

一万(0x1):0
二万(0x2):0 三万(0x3):0四万(0x4):0五万(0x5):2六万(0x6):0七万(0x7):1八万(0x8):0九万(0x9):0一筒(0x11):0二筒(0x12):0三筒(0x13):0四筒(0x14):0五筒(0x15):0六筒(0x16):0七筒(0x17):0八筒(0x18):1九筒(0x19):1一索(0x21):0二索(0x22):1三索(0x23):2四索(0x24):0五索(0x25):0六索(0x26):0七索(0x27):0八索(0x28):0九索(0x29):0(0x31):0(0x32):0西(0x33):0(0x34):0(0x41):1(0x42):1(0x43):1(0x51):1(0x52):0(0x53):0(0x54):0(0x55):0(0x56):0(0x57):1(0x58):0 

玩家3的牌数据:

一万(0x1):0
二万(0x2):0 三万(0x3):0四万(0x4):1五万(0x5):0六万(0x6):0七万(0x7):0八万(0x8):1九万(0x9):0一筒(0x11):0二筒(0x12):0三筒(0x13):0四筒(0x14):1五筒(0x15):1六筒(0x16):0七筒(0x17):0八筒(0x18):0九筒(0x19):0一索(0x21):1二索(0x22):0三索(0x23):1四索(0x24):1五索(0x25):1六索(0x26):1七索(0x27):0八索(0x28):0九索(0x29):0(0x31):1(0x32):0西(0x33):0(0x34):0(0x41):0(0x42):0(0x43):0(0x51):0(0x52):0(0x53):0(0x54):1(0x55):0(0x56):1(0x57):0(0x58):1 

-----------------------------------

玩家0的手牌:

六万(0x6) 一筒(0x11)二筒(0x12)三筒(0x13)九筒(0x19)四索(0x24)五索(0x25)八索(0x28)(0x31)(0x32)西(0x33)(0x42)(0x43) 

玩家1的手牌:

二万(0x2) 二万(0x2)五万(0x5)九万(0x9)五筒(0x15)九筒(0x19)一索(0x21)一索(0x21)四索(0x24)六索(0x26)(0x32)(0x34)(0x43) 

玩家2的手牌:

五万(0x5) 五万(0x5)七万(0x7)八筒(0x18)九筒(0x19)二索(0x22)三索(0x23)三索(0x23)(0x41)(0x42)(0x43)(0x51)(0x57) 

玩家3的手牌:

四万(0x4) 八万(0x8)四筒(0x14)五筒(0x15)一索(0x21)三索(0x23)四索(0x24)五索(0x25)六索(0x26)(0x31)(0x54)(0x56)(0x58) 

-----------------------------------

庄家: 玩家3

共出牌次数:0

从牌堆中取牌:

牌堆剩余:91

玩家3的手牌有14:

四万(0x4) 八万(0x8)四筒(0x14)五筒(0x15)一索(0x21)三索(0x23)四索(0x24)五索(0x25)六索(0x26)(0x31)(0x54)(0x55)(0x56)(0x58) 

玩家3要出的牌(比方三万):五万

输入错误,请又一次输入

玩家3要出的牌(比方三万):八万

出牌成功,轮到下家

出牌后玩家3的手牌有13:

四万(0x4) 四筒(0x14)五筒(0x15)一索(0x21)三索(0x23)四索(0x24)五索(0x25)六索(0x26)(0x31)(0x54)(0x55)(0x56)(0x58) 

-----------------------------------

共出牌次数:1

从牌堆中取牌:六万

牌堆剩余:90

玩家0的手牌有14:

六万(0x6) 六万(0x6)一筒(0x11)二筒(0x12)三筒(0x13)九筒(0x19)四索(0x24)五索(0x25)八索(0x28)(0x31)(0x32)西(0x33)(0x42)(0x43) 

玩家0要出的牌(比方三万):六万

出牌成功,轮到下家

出牌后玩家0的手牌有13:

六万(0x6) 一筒(0x11)二筒(0x12)三筒(0x13)九筒(0x19)四索(0x24)五索(0x25)八索(0x28)(0x31)(0x32)西(0x33)(0x42)(0x43) 

-----------------------------------

共出牌次数:2

从牌堆中取牌:六筒

牌堆剩余:89

玩家1的手牌有14:

二万(0x2) 二万(0x2)五万(0x5)九万(0x9)五筒(0x15)六筒(0x16)九筒(0x19)一索(0x21)一索(0x21)四索(0x24)六索(0x26)(0x32)(0x34)(0x43) 

玩家1要出的牌(比方三万):五万

出牌成功,轮到下家

出牌后玩家1的手牌有13:

二万(0x2) 二万(0x2)九万(0x9)五筒(0x15)六筒(0x16)九筒(0x19)一索(0x21)一索(0x21)四索(0x24)六索(0x26)(0x32)(0x34)(0x43) 

-----------------------------------

共出牌次数:3

从牌堆中取牌:一筒

牌堆剩余:88

玩家2的手牌有14:

五万(0x5) 五万(0x5)七万(0x7)一筒(0x11)八筒(0x18)九筒(0x19)二索(0x22)三索(0x23)三索(0x23)(0x41)(0x42)(0x43)(0x51)(0x57) 

玩家2要出的牌(比方三万):七万

出牌成功,轮到下家

出牌后玩家2的手牌有13:

五万(0x5) 五万(0x5)一筒(0x11)八筒(0x18)九筒(0x19)二索(0x22)三索(0x23)三索(0x23)(0x41)(0x42)(0x43)(0x51)(0x57) 

-----------------------------------

共出牌次数:4

从牌堆中取牌:六筒

牌堆剩余:87

玩家3的手牌有14:

四万(0x4) 四筒(0x14)五筒(0x15)六筒(0x16)一索(0x21)三索(0x23)四索(0x24)五索(0x25)六索(0x26)(0x31)(0x54)(0x55)(0x56)(0x58) 

玩家3要出的牌(比方三万):五筒

出牌成功,轮到下家

出牌后玩家3的手牌有13:

四万(0x4) 四筒(0x14)六筒(0x16)一索(0x21)三索(0x23)四索(0x24)五索(0x25)六索(0x26)(0x31)(0x54)(0x55)(0x56)(0x58) 

-----------------------------------

共出牌次数:5

从牌堆中取牌:七万

牌堆剩余:86

玩家0的手牌有14:

六万(0x6) 七万(0x7)一筒(0x11)二筒(0x12)三筒(0x13)九筒(0x19)四索(0x24)五索(0x25)八索(0x28)(0x31)(0x32)西(0x33)(0x42)(0x43) 

玩家0要出的牌(比方三万): 

cocos2dx 制作单机麻将(五)的更多相关文章

  1. cocos2dx 制作单机麻将(四)

    cocos2dx 制作单机麻将(四) 麻将逻辑5.模拟出牌 // // main.cpp // MajiangLogicTest // // Created by TinyUlt on 14-8-16 ...

  2. cocos2dx 制作单机麻将(一)

    今天開始打算解说下cocos2dx下怎样制作国标麻将 前半部分先解说麻将的逻辑部分,由于都是代码,可能会比較枯燥无聊. 这部分讲完后,你也能够用其它游戏引擎来制作麻将 后半部分,就解说余下的cocos ...

  3. cocos2dx 制作单机麻将(二)

    cocos2dx 制作单机麻将(二) 打乱麻将顺序2 前面解说了怎样打乱初始给定的麻将牌堆, 另一种是打乱随意给定的麻将牌堆 //混乱扑克2 void RandAppointCardData(BYTE ...

  4. cocos2dx 使得单麻将(三)

    cocos2dx 使得单麻将(三) 麻将逻辑4.得到手牌数据 我们已经保存了一个一维数组, 类似于一个表格,统计出全部牌相应的数量, 但我们如何得到当前手中是什么牌呢 //扑克转换 BYTE Swit ...

  5. 使用cocos2d-x制作 Texture unpacker

    使用cocos2d-x制作 Texture unpacker 没错,就是unpacker. 在大多数游戏包里面,可以找到很多纹理图集,他们基本上是用texture packer制作的,有plist文件 ...

  6. 只需要一点点C++基础,新手也可以制作单机游戏内存修改器

    声明:本文只是为了初学C++的,能够做出一些实用的东西,跳出管理系统的束缚,提升学习的兴趣,在这里选取了单机游戏,请不要尝试在线游戏,违发而已未必可行.序:首先我们需要一个Qt+VS环境Qt从http ...

  7. cocos2d-x游戏开发(十五)游戏加载动画loading界面

    个人原创,欢迎转载:http://blog.csdn.net/dawn_moon/article/details/11478885 这个资源加载的loading界面demo是在玩客网做逆转三国的时候随 ...

  8. Cocos2d-x学习笔记(五岁以下儿童) 精灵两种方式播放动画

     这几天在看控件类,临时没有想好实际运用的方向.单纯的创建网上已经有非常多这方面的样例,我就不写了.接下来是学习精灵类.精灵类若是单独学习也是非常easy.于是我加了一些有关动画方面的知识点与精灵 ...

  9. cocos2d-x学习之旅(五):1.5 使用eclipse编译cocos2d-x示例项目,创建cocos2d-x android项目并部署到真机

    今天将cocos2d-x的示例项目tests编译到android真机运行,以及如何创建cocos2d-x的android项目. 打开cocos2d-x的tests项目,路径为:D:\cocos2d-x ...

随机推荐

  1. 服务器禁用ping

    linux禁ping.这里操作的是centos6.5内核参数禁ping禁用ping #echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all启用ping ...

  2. 【收藏】史上最全的浏览器 CSS & JS Hack 手册

    浏览器渲染页面的方式各不相同,甚至同一浏览器的不同版本(“杰出代表”是 IE)也有差异.因此,浏览器兼容成为前端开发人员的必备技能.如果有一份浏览器 Hack 手册,那查询起来就方便多了.这篇文章就向 ...

  3. 使用iframe引入公共模块

    新建一个公共文件head.html <!DOCTYPE html><html lang="en"><head> <meta charset ...

  4. Luogu-P1020(导弹拦截)(DP,LIS ,二分优化)

    Luogu-P1020(导弹拦截)(DP) 题意: 给n(n<=100000) 个数字,求最长不上升子序列的长度和最少的不上升子序列的个数. 分析: 第一问: 求最长不上升子序列有 O(n^2) ...

  5. js多维数组扁平化

    数组扁平化,就是将多维数组碾平为一维数组,方便使用. 一:例如,一个二维数组 var arr = ['a', ['b', 2], ['c', 3, 'x']],将其扁平化: 1.  通过 apply ...

  6. Django框架基础知识04-模板标签与模板继承

    1.常用的模板标签 -作用是什么? -常用标签 总结:语法 {% tag %} {% endtag %} {% tag 参数 参数 %} 2.模板的继承与引用 -引用 include标签 -继承 ex ...

  7. Linux 基本操作指南

    Linux基本操作 1. su  切换用户   2.exit 退出当前登录用户 3.useradd 用户名  -m  在home目录下 创建一个和用户名同名的目录,并添加一个用户 (有root权限才能 ...

  8. LeetCode(10) Regular Expression Matching

    题目 Implement regular expression matching with support for '.' and '*'. '.' Matches any single charac ...

  9. 【UVA 10820】Send a Table(欧拉函数)

    Description When participating in programming contests, you sometimes face the following problem: Yo ...

  10. LayUI分页基于ASP.NET MVC

    ---恢复内容开始--- 今天写了挺久的分页,百度了很多都没有很好的.Net实例,今天我来更新一期关于layuiTable分页 首先你得理解layui的官方文档的Table分页部分,我在这里附上地址 ...