linux-keyboard.c: Fix 0 key contantly pressed on Linux
This commit is contained in:
parent
dba2b27310
commit
08087cb14a
|
|
@ -28,13 +28,9 @@ void kbd_init()
|
|||
}
|
||||
|
||||
keyboard_t kbd_getKeys() {
|
||||
SDL_Event event;
|
||||
keyboard_t keys = 0;
|
||||
while ((SDL_PollEvent(&event)) != 0) {
|
||||
if (event.type == SDL_QUIT)
|
||||
exit(0);
|
||||
//Ignore all non-keyboard events
|
||||
if (event.type != SDL_KEYDOWN) continue;
|
||||
SDL_PumpEvents();
|
||||
|
||||
const uint8_t *state = SDL_GetKeyboardState(NULL);
|
||||
if (state[SDL_SCANCODE_0]) keys |= KEY_0;
|
||||
if (state[SDL_SCANCODE_1]) keys |= KEY_1;
|
||||
|
|
@ -56,5 +52,4 @@ keyboard_t kbd_getKeys() {
|
|||
if (state[SDLK_PLUS]) keys |= KEY_MONI;
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue