mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-24 06:45:11 +00:00
Added a scroll wheel port to the mouse device
This commit is contained in:
parent
17af020cc0
commit
3276b370e8
1 changed files with 6 additions and 5 deletions
|
@ -155,7 +155,6 @@ domouse(SDL_Event *event)
|
||||||
Uint16 y = clamp(event->motion.y - PAD, 0, ppu.ver * 8 - 1);
|
Uint16 y = clamp(event->motion.y - PAD, 0, ppu.ver * 8 - 1);
|
||||||
mempoke16(devmouse->dat, 0x2, x);
|
mempoke16(devmouse->dat, 0x2, x);
|
||||||
mempoke16(devmouse->dat, 0x4, y);
|
mempoke16(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;
|
||||||
|
@ -164,9 +163,7 @@ domouse(SDL_Event *event)
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
devmouse->dat[6] |= flag;
|
devmouse->dat[6] |= flag;
|
||||||
if(flag == 0x10 && (devmouse->dat[6] & 0x01))
|
if(flag == 0x10 && (devmouse->dat[6] & 0x01))
|
||||||
devmouse->dat[7] = 0x01;
|
|
||||||
if(flag == 0x01 && (devmouse->dat[6] & 0x10))
|
if(flag == 0x01 && (devmouse->dat[6] & 0x10))
|
||||||
devmouse->dat[7] = 0x10;
|
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
devmouse->dat[6] &= (~flag);
|
devmouse->dat[6] &= (~flag);
|
||||||
|
@ -353,6 +350,10 @@ start(Uxn *u)
|
||||||
evaluxn(u, mempeek16(devctrl->dat, 0));
|
evaluxn(u, mempeek16(devctrl->dat, 0));
|
||||||
devctrl->dat[3] = 0;
|
devctrl->dat[3] = 0;
|
||||||
break;
|
break;
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
|
devmouse->dat[7] = event.wheel.y;
|
||||||
|
evaluxn(u, mempeek16(devmouse->dat, 0));
|
||||||
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
|
|
Loading…
Reference in a new issue