mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06:36 +00:00
Added support for joystick button and axis callbacks
This commit is contained in:
parent
f63824b250
commit
4e8d5ded78
26
src/input.c
26
src/input.c
@ -130,6 +130,18 @@ void _glfwInputJoystickChange(int joy, int event)
|
|||||||
_glfw.callbacks.joystick(joy, 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 //////
|
////// GLFW internal API //////
|
||||||
@ -618,6 +630,20 @@ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun)
|
|||||||
return 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)
|
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
Loading…
Reference in New Issue
Block a user