1
0
mirror of synced 2024-11-14 17:57:34 +01:00

Add mouse controls

This commit is contained in:
Bobby Dilley 2022-09-01 15:30:30 +01:00
parent 20599f5946
commit fb8b25bc86

View File

@ -179,6 +179,28 @@ int XNextEvent(Display *display, XEvent *event_return)
setAnalogue(ANALOGUE_2, ((double)event_return->xmotion.y / (double)getConfig()->height) * 255.0);
}
break;
case ButtonPress:
case ButtonRelease:
{
printf("%d %d %d\n", event_return->xbutton.button, event_return->xbutton.x, event_return->xbutton.y);
switch (event_return->xbutton.button)
{
case 1: // Trigger
setSwitch(PLAYER_1, BUTTON_1, event_return->type == ButtonPress);
break;
case 3: // Reload
setSwitch(PLAYER_1, BUTTON_2, event_return->type == ButtonPress);
break;
case 9: // Gun Button
setSwitch(PLAYER_1, BUTTON_3, event_return->type == ButtonPress);
break;
default:
break;
}
}
break;
}
return returnValue;