Browse Source

input with arrows

main
fdai7184 2 years ago
parent
commit
1fcf912e44
  1. 24
      src/input.c

24
src/input.c

@ -10,7 +10,8 @@ char getch(void);
/*int main(int argc, char ** argv){
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
int kbhit(void){

Loading…
Cancel
Save