Added mouse scroll

This commit is contained in:
neauoire 2022-04-05 19:31:53 -07:00
parent 18058c14f1
commit de3b0246e9
3 changed files with 9 additions and 4 deletions

View File

@ -37,12 +37,12 @@ cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DND
## Devices ## Devices
- `00` system - `00` system
- `10` console(partial) - `10` console
- `20` screen - `20` screen
- `30` audio(missing) - `30` audio(missing)
- `70` midi(missing) - `70` midi(missing)
- `80` controller - `80` controller
- `90` mouse(partial) - `90` mouse
- `a0` file - `a0` file
- `c0` datetime - `c0` datetime

View File

@ -148,7 +148,12 @@ processEvent(Uxn *u)
} break; } break;
case ButtonPress: { case ButtonPress: {
XButtonPressedEvent *e = (XButtonPressedEvent *)&ev; XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;
mouse_down(u, &u->dev[0x90], 0x1 << (e->button - 1)); if(e->button == 4)
mouse_scroll(u, &u->dev[0x90], 0, 1);
else if(e->button == 5)
mouse_scroll(u, &u->dev[0x90], 0, -1);
else
mouse_down(u, &u->dev[0x90], 0x1 << (e->button - 1));
} break; } break;
case ButtonRelease: { case ButtonRelease: {
XButtonPressedEvent *e = (XButtonPressedEvent *)&ev; XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;