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
- `00` system
- `10` console(partial)
- `10` console
- `20` screen
- `30` audio(missing)
- `70` midi(missing)
- `80` controller
- `90` mouse(partial)
- `90` mouse
- `a0` file
- `c0` datetime

View File

@ -32,4 +32,4 @@ bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/
echo "Running.."
bin/uxn11 bin/polycat.rom
echo "Done."
echo "Done."

View File

@ -148,7 +148,12 @@ processEvent(Uxn *u)
} break;
case ButtonPress: {
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;
case ButtonRelease: {
XButtonPressedEvent *e = (XButtonPressedEvent *)&ev;