Wiki Page Content

Differences between revisions 5 and 6
Revision 5 as of 2013-09-01 18:36:08
Size: 1641
Comment: Updated usage of Color2 macro.
Revision 6 as of 2013-10-05 13:03:02
Size: 1433
Editor: Zalerinian
Comment: Formatting; Added related function SDL_GameControllerEventState; Added note about using -1, 0, or 1 for SDL_QUERY/IGNORE/ENABLE; Added code example
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
||'''state'''||can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE||
<<Color2(col=green,text="Confused - seems like '''state''' should be an integer but these are not integers. Since RV is also an integer I'm not sure where this info belongs. Is this an error? Should this be somehow liked to [[SDL_EventState]]()?")>>
||'''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.
Line 20: Line 20:
Returns ^1 if enabled, 0 if disabled^, or a negative error code on failure; call [[SDL_GetError]]() for more information. Returns 1 if enabled, 0 if disabled, or a negative error code on failure; call [[SDL_GetError]]() for more information.
Line 22: Line 22:
*<<BR>>If '''state''' is SDL_QUERY then the current state is returned, otherwise the new processing state is returned. <<BR>>* If '''state''' is SDL_QUERY then the current state is returned, otherwise the new processing state is returned.
Line 26: Line 26:
You can add your code example here cout << SDL_JoystickEventState(SDL_QUERY) << endl; // 1
cout << SDL_JoystickEventState(SDL_IGNORE) << endl; // 0
cout << SDL_JoystickEventState(SDL_QUERY) << endl; // 0
Line 30: Line 32:
*<<BR>>This function is used to enable or disable joystick event processing. <<BR>>* If joystick events are disabled, you must call [[SDL_JoystickUpdate]]() yourself and manually check the state of the joystick when you want joystick information.
Line 32: Line 34:
If joystick events are disabled, you must call [[SDL_JoystickUpdate]]() yourself ,,and,, ^to manually?^ check the state of the joystick when you want joystick information.

*<<BR>>Note: Joystick event handling is preferred.

Note: Even if joystick event processing is enabled, individual joysticks must be opened before they generate events.

Warning: Calling this function may delete all events currently in SDL's event queue. <<BR>>*
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.
Line 41: Line 38:
 .[[SDL_GameControllerEventState]]

DRAFT

SDL_JoystickEventState

Use this function to enable/disable joystick event polling.

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

cout << SDL_JoystickEventState(SDL_QUERY)  << endl;  // 1
cout << SDL_JoystickEventState(SDL_IGNORE) << endl;  // 0
cout << SDL_JoystickEventState(SDL_QUERY)  << endl;  // 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.


CategoryAPI, CategoryJoystick

None: SDL_JoystickEventState (last edited 2015-10-29 21:39:34 by PhilippWiesemann)

Feedback
Please include your contact information if you'd like to receive a reply.
Submit