X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=keys.c;h=817ce92da6a38ae589788aa4f374b33ba420db61;hb=51060d945ef856d4f54728526df21c551b8e4dcf;hp=ea6e2d5985c397392f77eb1563806ad25adde2b2;hpb=db717d093453e95a1fc005d7c884b12562d7ca9f;p=xonotic%2Fdarkplaces.git diff --git a/keys.c b/keys.c index ea6e2d59..817ce92d 100644 --- a/keys.c +++ b/keys.c @@ -1959,6 +1959,21 @@ Key_Event (int key, int ascii, qboolean down) } } +// a helper to simulate release of ALL keys +void +Key_ReleaseAll (void) +{ + int key; + // clear the event queue first + eventqueue_idx = 0; + // then send all down events (possibly into the event queue) + for(key = 0; key < MAX_KEYS; ++key) + if(keydown[key]) + Key_Event(key, 0, false); + // now all keys are guaranteed down (once the event queue is unblocked) + // and only future events count +} + /* =================== Key_ClearStates