mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +00:00
Added support for joystick button and axis callbacks
This commit is contained in:
parent
e6a32db7b9
commit
3bee851242
@ -1121,6 +1121,42 @@ typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
|
|||||||
*/
|
*/
|
||||||
typedef void (* GLFWjoystickfun)(int,int);
|
typedef void (* GLFWjoystickfun)(int,int);
|
||||||
|
|
||||||
|
/*! @brief The function signature for joystick button callbacks.
|
||||||
|
*
|
||||||
|
* This is the function signature for joystick button callback
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
* @param[in] joy The joystick that had a button pressed or released.
|
||||||
|
* @param[in] button The button that was pressed or released.
|
||||||
|
* @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
|
||||||
|
*
|
||||||
|
* @sa @ref joystick_event
|
||||||
|
* @sa glfwSetJoystickButtonCallback
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
typedef void (* GLFWjoystickbuttonfun)(int,int,int);
|
||||||
|
|
||||||
|
/*! @brief The function signature for joystick axis callbacks.
|
||||||
|
*
|
||||||
|
* This is the function signature for joystick axis callback
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
* @param[in] joy The joystick that had an axis moved.
|
||||||
|
* @param[in] axis The axis that was moved.
|
||||||
|
* @param[in] value The axis value.
|
||||||
|
*
|
||||||
|
* @sa @ref joystick_event
|
||||||
|
* @sa glfwSetJoystickAxisCallback
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
typedef void (* GLFWjoystickaxisfun)(int,int,float);
|
||||||
|
|
||||||
/*! @brief Video mode type.
|
/*! @brief Video mode type.
|
||||||
*
|
*
|
||||||
* This describes a single video mode.
|
* This describes a single video mode.
|
||||||
@ -3680,6 +3716,50 @@ GLFWAPI const char* glfwGetJoystickName(int joy);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
|
GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun);
|
||||||
|
|
||||||
|
/*! @brief Sets the joystick button callback.
|
||||||
|
*
|
||||||
|
* This function sets the joystick button callback, or removes the currently
|
||||||
|
* set callback. This is called when a joystick button is pressed or released.
|
||||||
|
*
|
||||||
|
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||||
|
* callback.
|
||||||
|
* @return The previously set callback, or `NULL` if no callback was set or the
|
||||||
|
* library had not been [initialized](@ref intro_init).
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref joystick_event
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI GLFWjoystickbuttonfun glfwSetJoystickButtonCallback(GLFWjoystickbuttonfun cbfun);
|
||||||
|
|
||||||
|
/*! @brief Sets the joystick axis callback.
|
||||||
|
*
|
||||||
|
* This function sets the joystick axis callback, or removes the currently
|
||||||
|
* set callback. This is called when a joystick axis is moved.
|
||||||
|
*
|
||||||
|
* @param[in] cbfun The new callback, or `NULL` to remove the currently set
|
||||||
|
* callback.
|
||||||
|
* @return The previously set callback, or `NULL` if no callback was set or the
|
||||||
|
* library had not been [initialized](@ref intro_init).
|
||||||
|
*
|
||||||
|
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||||
|
*
|
||||||
|
* @thread_safety This function must only be called from the main thread.
|
||||||
|
*
|
||||||
|
* @sa @ref joystick_event
|
||||||
|
*
|
||||||
|
* @since Added in version 3.2.
|
||||||
|
*
|
||||||
|
* @ingroup input
|
||||||
|
*/
|
||||||
|
GLFWAPI GLFWjoystickaxisfun glfwSetJoystickAxisCallback(GLFWjoystickaxisfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the clipboard to the specified string.
|
/*! @brief Sets the clipboard to the specified string.
|
||||||
*
|
*
|
||||||
* This function sets the system clipboard to the specified, UTF-8 encoded
|
* This function sets the system clipboard to the specified, UTF-8 encoded
|
||||||
|
Loading…
Reference in New Issue
Block a user