
KEYUP SDL2 RUST CODE
Unfortunatelly I have both 1) not discovered 100% reproducible pattern for the bug yet (seems like it happens on burst sequental presses), 2) have no ideas what is the cause.įor now I just want, a fresh view on my code (is it solid?) and maybe some ideas on what to check. Every other key on the keyboard registers in my debug statement at the top of the SDLKEYDOWN case. I tried using some debugging code to print out which key is being pressed and when you press space down nothing registers. Lasts for infinite amount of time.įor example, I press Right ( D), the movement to right starts, shortly after I press Fire ( SPACE), movement is stopped, no firing occurs, then after key repeat interval firing starts, but movement to Right is stopped despite key is also still pressed. What is even more bizarre is that the SDLKEYUP switch of SDLKSPACE works great.

I have a very minimal SDL2 template I use when I need to draw an image, display it (in a maximized window), and wait for a keypress. Marshal.Copy(_keysBuffer, _keysCurr, 0, _numkeys) Īll is workig as expected mostly, however once in while one of the following behavior occurs: (premise: the (pseudo) code is in Rust, however, answers in any language are accepted, since the Rust SDL library mimics closely the standard one). Once youve installed this package, you can start Idris with the -p sdl flag. _keysBuffer = SDL_GetKeyboardState(out _numkeys) Newer languages such as Rust and Julia have.

Private static byte _keysPrev = new byte

Private static byte _keysCurr = new byte Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this: // class members
