Hi guys, this is what i wrote:
if(kbhit()){
a=[some function returning last key pressed];
doaction(a);
}
doaction() is a function i wrote but it doesnt matter. What does matter is how to get a character from keyboard without interrupting execution just like getch() does. I am thinking of making a game so i need the game not to wait for the player to press a key, the game should go on. By using kbhit() i know whether a key was pressed, but i dunno which key. That is the problem i am currently facing. If there is something i didn't write in a clear way, please let me know it.
if(kbhit()){
a=[some function returning last key pressed];
doaction(a);
}
doaction() is a function i wrote but it doesnt matter. What does matter is how to get a character from keyboard without interrupting execution just like getch() does. I am thinking of making a game so i need the game not to wait for the player to press a key, the game should go on. By using kbhit() i know whether a key was pressed, but i dunno which key. That is the problem i am currently facing. If there is something i didn't write in a clear way, please let me know it.
Comment