Switch case for fkey handler

This commit is contained in:
Devine Lu Linvega 2024-01-15 11:33:56 -08:00
parent aaa70e12eb
commit 0ac9f19974
1 changed files with 6 additions and 8 deletions

View File

@ -146,14 +146,12 @@ emu_event(Uxn *u)
KeySym sym;
char buf[7];
XLookupString((XKeyPressedEvent *)&ev, buf, 7, &sym, 0);
if(sym == XK_F1)
toggle_scale();
else if(sym == XK_F2)
u->dev[0x0e] = !u->dev[0x0e];
else if(sym == XK_F4)
emu_restart(u, boot_rom, 0);
else if(sym == XK_F5)
emu_restart(u, boot_rom, 1);
switch(sym){
case XK_F1: toggle_scale(); break;
case XK_F2: u->dev[0x0e] = !u->dev[0x0e]; break;
case XK_F4: emu_restart(u, boot_rom, 0); break;
case XK_F5: emu_restart(u, boot_rom, 1); break;
}
controller_down(u, &u->dev[0x80], get_button(sym));
controller_key(u, &u->dev[0x80], sym < 0x80 ? sym : (Uint8)buf[0]);
} break;