mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 14:45:46 +00:00
Add glfwSetJoystickCallback
This commit is contained in:
@@ -190,6 +190,8 @@ static void removeJoystick(_GLFWjoydeviceNS* joystick)
|
||||
free(joystick->buttons);
|
||||
|
||||
memset(joystick, 0, sizeof(_GLFWjoydeviceNS));
|
||||
|
||||
_glfwInputJoystickChange(joystick - _glfw.ns_js.devices, GLFW_DISCONNECTED);
|
||||
}
|
||||
|
||||
// Polls for joystick axis events and updates GLFW state
|
||||
@@ -329,6 +331,8 @@ static void matchCallback(void* context,
|
||||
sizeof(float));
|
||||
joystick->buttons = calloc(CFArrayGetCount(joystick->buttonElements) +
|
||||
CFArrayGetCount(joystick->hatElements) * 4, 1);
|
||||
|
||||
_glfwInputJoystickChange(joy, GLFW_CONNECTED);
|
||||
}
|
||||
|
||||
// Callback for user-initiated joystick removal
|
||||
|
||||
Reference in New Issue
Block a user