0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-16 03:05:06 +00:00

emu: make sure to handle key down event if the same key is up at the same frame

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-12-29 23:31:08 +01:00
parent 173f6f8678
commit 666b576761

View file

@ -518,6 +518,11 @@ run(Uxn *u)
controller_down(devctrl, get_button(&event)); controller_down(devctrl, get_button(&event));
else else
do_shortcut(u, &event); do_shortcut(u, &event);
if(event.type == SDL_KEYDOWN) {
int ksym = event.key.keysym.sym;
if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym)
break;
}
} else if(event.type == SDL_KEYUP) } else if(event.type == SDL_KEYUP)
controller_up(devctrl, get_button(&event)); controller_up(devctrl, get_button(&event));
else if(event.type == SDL_JOYAXISMOTION) { else if(event.type == SDL_JOYAXISMOTION) {