For a game I'm coding, I need to check for continuously held keys. I read the key pressed with bioskey. How can I clear the buffer in each iteration of the while loop? Is there any other way to implement a continuously held key?
while()
{
if(bioskey(1)) key=bioskey(0); <--If keyboard buffer is not empty, get . and remove one key data.
//code here <--If key is continuously held down,
then buffer gets filled here.
}
Are you writing this game with the windows API by any chance? There's a simple callback you can implement that does this with events without the use of polling for a keypress.