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

Further fixes to keyboard handling

This commit is contained in:
Andrew Alderwick 2021-06-20 22:38:45 +01:00
parent b3ffe598c4
commit 2d1c3aa965

View file

@ -209,11 +209,12 @@ doctrl(Uxn *u, SDL_Event *event, int z)
case SDLK_DOWN: flag = 0x20; break; case SDLK_DOWN: flag = 0x20; break;
case SDLK_LEFT: flag = 0x40; break; case SDLK_LEFT: flag = 0x40; break;
case SDLK_RIGHT: flag = 0x80; break; case SDLK_RIGHT: flag = 0x80; break;
case SDLK_DELETE: devctrl->dat[3] = z ? 0x7f : 0x00; break;
} }
if(z) if(z) {
devctrl->dat[2] |= flag; devctrl->dat[2] |= flag;
else if(event->key.keysym.sym < 0x20 || event->key.keysym.sym == SDLK_DELETE)
devctrl->dat[3] = event->key.keysym.sym;
} else
devctrl->dat[2] &= ~flag; devctrl->dat[2] &= ~flag;
} }
@ -360,7 +361,7 @@ start(Uxn *u)
quit(); quit();
break; break;
case SDL_TEXTINPUT: case SDL_TEXTINPUT:
devctrl->dat[3] = event.text.text[0]; devctrl->dat[3] = event.text.text[0]; /* fall-thru */
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
doctrl(u, &event, event.type == SDL_KEYDOWN); doctrl(u, &event, event.type == SDL_KEYDOWN);