uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 93e64c93e8bea5c5f6d3328c7430c6653bdfa1e0
parent 617364916ef3744d14c8885a4190b9dd1455a5ca
Author: neauoire <aliceffekt@gmail.com>
Date:   Fri, 25 Jun 2021 09:21:11 -0700

Trying to fix the ctrl+char issue

Diffstat:
Msrc/uxnemu.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -189,11 +189,7 @@ doctrl(Uxn *u, SDL_Event *event, int z) Uint8 flag = 0x00; SDL_Keymod mods = SDL_GetModState(); devctrl->dat[2] &= 0xf8; - if(mods & KMOD_CTRL) { - devctrl->dat[2] |= 0x01; - if(z && event->key.keysym.sym >= SDLK_a && event->key.keysym.sym <= SDLK_z) - devctrl->dat[3] = event->key.keysym.sym & 0x1f; - } + if(mods & KMOD_CTRL) devctrl->dat[2] |= 0x01; if(mods & KMOD_ALT) devctrl->dat[2] |= 0x02; if(mods & KMOD_SHIFT) devctrl->dat[2] |= 0x04; /* clang-format off */ @@ -207,11 +203,14 @@ doctrl(Uxn *u, SDL_Event *event, int z) case SDLK_F2: if(z) toggledebug(u); break; case SDLK_F3: if(z) screencapture(); break; } + /* clang-format on */ if(z) { devctrl->dat[2] |= flag; if(event->key.keysym.sym < 0x20 || event->key.keysym.sym == SDLK_DELETE) devctrl->dat[3] = event->key.keysym.sym; + else if((mods & KMOD_CTRL) && event->key.keysym.sym >= SDLK_a && event->key.keysym.sym <= SDLK_z) + devctrl->dat[3] = event->key.keysym.sym - (mods & KMOD_SHIFT) * 0x20; } else devctrl->dat[2] &= ~flag; }