1
0
mirror of synced 2024-11-28 03:20:48 +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); setAnalogue(ANALOGUE_2, ((double)event_return->xmotion.y / (double)getConfig()->height) * 255.0);
} }
break; 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; return returnValue;