本文整理汇总了C++中Snake::getPosY方法的典型用法代码示例。如果您正苦于以下问题:C++ Snake::getPosY方法的具体用法?C++ Snake::getPosY怎么用?C++ Snake::getPosY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snake
的用法示例。
在下文中一共展示了Snake::getPosY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: proccessEvent
void Controller::proccessEvent(int evt,char port[10])
{
if (strcmp(port, "9000")==0) {
switch (evt)
{
case KEY_DOWN:
playerOne.setPlayerPosY(playerOne.getPosY()+2);
break;
case KEY_RIGHT:
playerOne.setPlayerPosX(playerOne.getPosX()+2);
break;
default:
break;
}
}else if(strcmp(port,"9001")==0)
{
switch (evt)
{
case KEY_DOWN:
playerTwo.setPlayerPosY(playerTwo.getPosY() + 1);
break;
case KEY_RIGHT:
playerTwo.setPlayerPosX(playerTwo.getPosX() + 1);
break;
default:
break;
}
}
}
示例2: getSnakeY
unsigned char Controller::getSnakeY(char port[10])
{
if(strcmp(port, "9000")==0)
{
return playerTwo.getPosY();
}else if(strcmp(port, "9001")==0)
{
return playerTwo.getPosY();
}else{
return 0;
}
}
示例3: returnSnakeData
char* Controller::returnSnakeData(char port[10])
{
if(strcmp(port, "9000")==0)
{
unsigned char p1X = playerOne.getPosX();
unsigned char p1Y = playerOne.getPosY();
clientMessage2.posX = p1X;
clientMessage2.posY = p1Y;
}else if(strcmp(port, "9001")==0)
{
unsigned char p2X = playerTwo.getPosX();
unsigned char p2Y = playerTwo.getPosY();
clientMessage2.posX = p2X;
clientMessage2.posY = p2Y;
}
clientMessage2.typeId = 100;
void *ptr = (void*) &clientMessage2;
char *txt = (char*) ptr;
return txt;
}