uxn

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

commit 3276b370e888c4cc349e02487350375d42d650fd
parent 17af020cc0e8156c6f592f7a94b12588a8be8da2
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat, 29 May 2021 15:01:19 -0700

Added a scroll wheel port to the mouse device

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

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -155,7 +155,6 @@ domouse(SDL_Event *event) Uint16 y = clamp(event->motion.y - PAD, 0, ppu.ver * 8 - 1); mempoke16(devmouse->dat, 0x2, x); mempoke16(devmouse->dat, 0x4, y); - devmouse->dat[7] = 0x00; switch(event->button.button) { case SDL_BUTTON_LEFT: flag = 0x01; break; case SDL_BUTTON_RIGHT: flag = 0x10; break; @@ -164,10 +163,8 @@ domouse(SDL_Event *event) case SDL_MOUSEBUTTONDOWN: devmouse->dat[6] |= flag; if(flag == 0x10 && (devmouse->dat[6] & 0x01)) - devmouse->dat[7] = 0x01; - if(flag == 0x01 && (devmouse->dat[6] & 0x10)) - devmouse->dat[7] = 0x10; - break; + if(flag == 0x01 && (devmouse->dat[6] & 0x10)) + break; case SDL_MOUSEBUTTONUP: devmouse->dat[6] &= (~flag); break; @@ -353,6 +350,10 @@ start(Uxn *u) evaluxn(u, mempeek16(devctrl->dat, 0)); devctrl->dat[3] = 0; break; + case SDL_MOUSEWHEEL: + devmouse->dat[7] = event.wheel.y; + evaluxn(u, mempeek16(devmouse->dat, 0)); + break; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEMOTION: