|
Size: 1805
Comment: Removed spaces in example.
|
Size: 1795
Comment: Removed *s.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 19: | Line 19: |
| Returns ^a pointer to^ an array of key states. *A value of 1 means that the key is pressed and a value of 0 means that it is not.* Indexes into this array are obtained by using [[SDL_Scancode]] values. *The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.* | Returns ^a pointer to^ an array of key states. A value of 1 means that the key is pressed and a value of 0 means that it is not. Indexes into this array are obtained by using [[SDL_Scancode]] values. The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller. |
| Line 31: | Line 31: |
| *<<Color2(col=green,text="From [[SDL_GetKeyState]] in old wiki.")>><<BR>> | <<Color2(col=green,text="From [[SDL_GetKeyState]] in old wiki.")>><<BR>> |
| Line 36: | Line 36: |
| Note: This function doesn't take into account whether shift has been pressed or not. <<BR>>* | Note: This function doesn't take into account whether shift has been pressed or not. <<BR>> |
| Line 39: | Line 39: |
| .[[SDL_PumpEvents]] * | .[[SDL_PumpEvents]] |
DRAFT |
SDL_GetKeyboardState
Use this function to get a snapshot of the current state of the keyboard.
Contents
Syntax
const Uint8* SDL_GetKeyboardState(int* numkeys)
Function Parameters
numkeys |
if non-NULL, receives the length of the returned array |
Return Value
Returns a pointer to an array of key states. A value of 1 means that the key is pressed and a value of 0 means that it is not. Indexes into this array are obtained by using SDL_Scancode values. The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application and should not be freed by the caller.
Code Examples
Is this entered correctly? Does the \code and \endcode go in or is that doxygen markup in the header? There is a different example in the old wiki.
const Uint8 *state = SDL_GetKeyboardState(NULL);
if (state[SDL_SCANCODE_RETURN]) {
printf("<RETURN> is pressed.\n");
}
Remarks
From SDL_GetKeyState in old wiki.
Note: Use SDL_PumpEvents() to update the state array.
Note: This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the getstate formatting here ok?
calls.
Note: This function doesn't take into account whether shift has been pressed or not.
