|
Size: 1433
Comment: Formatting; Added related function SDL_GameControllerEventState; Added note about using -1, 0, or 1 for SDL_QUERY/IGNORE/ENABLE; Added code example
|
Size: 1460
Comment: Changed example from C++ to C.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 26: | Line 26: |
| cout << SDL_JoystickEventState(SDL_QUERY) << endl; // 1 cout << SDL_JoystickEventState(SDL_IGNORE) << endl; // 0 cout << SDL_JoystickEventState(SDL_QUERY) << endl; // 0 |
printf("%i\n", SDL_JoystickEventState(SDL_QUERY)); /* prints 1 */ printf("%i\n", SDL_JoystickEventState(SDL_IGNORE)); /* prints 0 */ printf("%i\n", SDL_JoystickEventState(SDL_QUERY)); /* prints 0 */ |
DRAFT |
SDL_JoystickEventState
Use this function to enable/disable joystick event polling.
Contents
Syntax
int SDL_JoystickEventState(int state)
Function Parameters
state |
can be one of SDL_QUERY, SDL_IGNORE, or SDL_ENABLE |
Note: You may use -1, 0, or 1 in place of SDL_QUERY, SDL_IGNORE, or SDL_ENABLE respectively.
Return Value
Returns 1 if enabled, 0 if disabled, or a negative error code on failure; call SDL_GetError() for more information.
If state is SDL_QUERY then the current state is returned, otherwise the new processing state is returned.
Code Examples
printf("%i\n", SDL_JoystickEventState(SDL_QUERY)); /* prints 1 */
printf("%i\n", SDL_JoystickEventState(SDL_IGNORE)); /* prints 0 */
printf("%i\n", SDL_JoystickEventState(SDL_QUERY)); /* prints 0 */
Remarks
If joystick events are disabled, you must call SDL_JoystickUpdate() yourself and manually check the state of the joystick when you want joystick information.
Note: It is recommended that you leave Joystick Event Handling enabled. Warning: Calling this function may delete all events currently in SDL's event queue.
