From 4e8d5ded78413162a38c2fd429f6ddaba69c1fa7 Mon Sep 17 00:00:00 2001 From: IntellectualKitty Date: Wed, 7 Sep 2016 15:07:19 -0600 Subject: [PATCH] Added support for joystick button and axis callbacks --- src/input.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/input.c b/src/input.c index c09599212..af4e49151 100644 --- a/src/input.c +++ b/src/input.c @@ -130,6 +130,18 @@ void _glfwInputJoystickChange(int joy, int event) _glfw.callbacks.joystick(joy, event); } +void _glfwInputJoystickButtonState(int joy, int button, int action) +{ + if (_glfw.callbacks.joystick_button) + _glfw.callbacks.joystick_button(joy, button, action); +} + +void _glfwInputJoystickAxisMoved(int joy, int axis, float value) +{ + if (_glfw.callbacks.joystick_axis) + _glfw.callbacks.joystick_axis(joy, axis, value); +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// @@ -618,6 +630,20 @@ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun) return cbfun; } +GLFWAPI GLFWjoystickbuttonfun glfwSetJoystickButtonCallback(GLFWjoystickbuttonfun cbfun) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_SWAP_POINTERS(_glfw.callbacks.joystick_button, cbfun); + return cbfun; +} + +GLFWAPI GLFWjoystickaxisfun glfwSetJoystickAxisCallback(GLFWjoystickaxisfun cbfun) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + _GLFW_SWAP_POINTERS(_glfw.callbacks.joystick_axis, cbfun); + return cbfun; +} + GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string) { _GLFWwindow* window = (_GLFWwindow*) handle;