1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 03:01:22 +00:00

Minor patch to SLEEP and the console, so it only responds with keydown events and not key up events.

This commit is contained in:
SteveMcNeill 2019-10-30 17:57:33 -04:00
parent eba05938bb
commit 0c1dcaf541

View file

@ -15287,11 +15287,12 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#ifdef QB64_WINDOWS
if (read_page->console){
int32 junk=0,junk2=0;
do{ //ignore all console input
junk=func__getconsoleinput();
junk2=consolekey;
}while(junk!=1); //until we have a key down event
do{ //ignore all console input unless it's a keydown event
do{ //ignore all console input uless it's a keyboard event
junk=func__getconsoleinput();
junk2=consolekey;
}while(junk!=1); //only when junk = 1 do we have a keyboard event
}while(junk2<=0); //only when junk2 > 0 do we have a key down event. (values less than 0 are key up events; 0 is a non event)
do{ //now continue to get the console input
junk=func__getconsoleinput();
}while(consolekey!=-junk2); //until that key is released. We don't need to leave the key up sequence in the buffer to screw things up with future reads.