c语言(!kbhit()==0)这句怎么理解
代码voidkey(){if(kbhit()!=0){charin;while(!kbhit()==0)in=getch();switch(in){case'w':cas...
代码
void key()
{
if(kbhit()!=0)
{
char in;
while(!kbhit()==0)
in=getch();
switch(in)
{
case 'w':
case 'W':
if(direction!=DOWN)
direction=UP;
break;
case 's':
case 'S':
if(direction!=UP)
direction=DOWN;
break;
case 'a':
case 'A':
if(direction!=RIGHT)
direction=LEFT;
break;
case 'd':
case 'D':
if(direction!=LEFT)
direction=RIGHT;
break;
}
}
} 展开
void key()
{
if(kbhit()!=0)
{
char in;
while(!kbhit()==0)
in=getch();
switch(in)
{
case 'w':
case 'W':
if(direction!=DOWN)
direction=UP;
break;
case 's':
case 'S':
if(direction!=UP)
direction=DOWN;
break;
case 'a':
case 'A':
if(direction!=RIGHT)
direction=LEFT;
break;
case 'd':
case 'D':
if(direction!=LEFT)
direction=RIGHT;
break;
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |