Moved mouse-wheel event into domouse

This commit is contained in:
neauoire 2021-09-22 11:53:13 -07:00
parent 5905afc97d
commit f2260abed0
1 changed files with 5 additions and 4 deletions

View File

@ -284,8 +284,13 @@ domouse(SDL_Event *event)
Uint8 flag = 0x00; Uint8 flag = 0x00;
Uint16 x = clamp(event->motion.x - PAD, 0, ppu.width - 1); Uint16 x = clamp(event->motion.x - PAD, 0, ppu.width - 1);
Uint16 y = clamp(event->motion.y - PAD, 0, ppu.height - 1); Uint16 y = clamp(event->motion.y - PAD, 0, ppu.height - 1);
if(event->type == SDL_MOUSEWHEEL) {
devmouse->dat[7] = event->wheel.y;
return;
}
poke16(devmouse->dat, 0x2, x); poke16(devmouse->dat, 0x2, x);
poke16(devmouse->dat, 0x4, y); poke16(devmouse->dat, 0x4, y);
devmouse->dat[7] = 0x00;
switch(event->button.button) { switch(event->button.button) {
case SDL_BUTTON_LEFT: flag = 0x01; break; case SDL_BUTTON_LEFT: flag = 0x01; break;
case SDL_BUTTON_RIGHT: flag = 0x10; break; case SDL_BUTTON_RIGHT: flag = 0x10; break;
@ -525,10 +530,6 @@ run(Uxn *u)
devctrl->dat[3] = 0; devctrl->dat[3] = 0;
break; break;
case SDL_MOUSEWHEEL: case SDL_MOUSEWHEEL:
devmouse->dat[7] = event.wheel.y;
uxn_eval(u, peek16(devmouse->dat, 0));
devmouse->dat[7] = 0;
break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION: