Added support for joystick button and axis callbacks

This commit is contained in:
IntellectualKitty 2016-09-07 15:08:15 -06:00 committed by GitHub
parent 4e8d5ded78
commit ed211f35b5

View File

@ -474,6 +474,18 @@ static void joystick_callback(int joy, int event)
}
}
static void joystick_button_callback(int joy, int button, int action)
{
printf("%08x at %0.3f: Joystick %i button %i was %s\n",
counter++, glfwGetTime(), joy, button, get_action_name(action));
}
static void joystick_axis_callback(int joy, int axis, float value)
{
printf("%08x at %0.3f: Joystick %i axis %i was moved to %f\n",
counter++, glfwGetTime(), joy, axis, value);
}
int main(int argc, char** argv)
{
Slot* slots;
@ -491,6 +503,8 @@ int main(int argc, char** argv)
glfwSetMonitorCallback(monitor_callback);
glfwSetJoystickCallback(joystick_callback);
glfwSetJoystickButtonCallback(joystick_button_callback);
glfwSetJoystickAxisCallback(joystick_axis_callback);
while ((ch = getopt(argc, argv, "hfn:")) != -1)
{