|
@ -10,7 +10,8 @@ char getch(void); |
|
|
|
|
|
|
|
|
/*int main(int argc, char ** argv){ |
|
|
/*int main(int argc, char ** argv){ |
|
|
while(1){ |
|
|
while(1){ |
|
|
getInput(); |
|
|
|
|
|
|
|
|
//getInput(); |
|
|
|
|
|
testArrowInput(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
}*/ |
|
@ -33,6 +34,27 @@ void getInput(){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void testArrowInput(){ |
|
|
|
|
|
if(kbhit()){ |
|
|
|
|
|
if(getch() == '\033'){ |
|
|
|
|
|
getch(); |
|
|
|
|
|
char key = getch(); |
|
|
|
|
|
if(key=='A'){ |
|
|
|
|
|
printf("up"); |
|
|
|
|
|
} |
|
|
|
|
|
else if(key=='B'){ |
|
|
|
|
|
printf("down"); |
|
|
|
|
|
} |
|
|
|
|
|
else if(key=='C'){ |
|
|
|
|
|
printf("right"); |
|
|
|
|
|
} |
|
|
|
|
|
else if(key=='D'){ |
|
|
|
|
|
printf("left"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//khbit und getch aus dem Internet |
|
|
//khbit und getch aus dem Internet |
|
|
int kbhit(void){ |
|
|
int kbhit(void){ |
|
|