Mercurial > sdl-ios-xcode
comparison include/SDL_keyboard.h @ 5281:15a71bec4a55
merged
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Sat, 12 Feb 2011 19:16:09 -0800 |
parents | b530ef003506 |
children |
comparison
equal
deleted
inserted
replaced
5219:adfcdd311ae0 | 5281:15a71bec4a55 |
---|---|
1 /* | 1 /* |
2 SDL - Simple DirectMedia Layer | 2 SDL - Simple DirectMedia Layer |
3 Copyright (C) 1997-2010 Sam Lantinga | 3 Copyright (C) 1997-2011 Sam Lantinga |
4 | 4 |
5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Lesser General Public | 6 modify it under the terms of the GNU Lesser General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2.1 of the License, or (at your option) any later version. | 8 version 2.1 of the License, or (at your option) any later version. |
43 #endif | 43 #endif |
44 | 44 |
45 /** | 45 /** |
46 * \brief The SDL keysym structure, used in key events. | 46 * \brief The SDL keysym structure, used in key events. |
47 */ | 47 */ |
48 typedef struct SDL_KeySym | 48 typedef struct SDL_Keysym |
49 { | 49 { |
50 SDL_ScanCode scancode; /**< SDL physical key code - see ::SDL_ScanCode for details */ | 50 SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ |
51 SDLKey sym; /**< SDL virtual key code - see ::SDLKey for details */ | 51 SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ |
52 Uint16 mod; /**< current key modifiers */ | 52 Uint16 mod; /**< current key modifiers */ |
53 Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */ | 53 Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */ |
54 } SDL_KeySym; | 54 } SDL_Keysym; |
55 | 55 |
56 /* Function prototypes */ | 56 /* Function prototypes */ |
57 | 57 |
58 /** | 58 /** |
59 * \brief Get the window which currently has keyboard focus. | 59 * \brief Get the window which currently has keyboard focus. |
63 /** | 63 /** |
64 * \brief Get a snapshot of the current state of the keyboard. | 64 * \brief Get a snapshot of the current state of the keyboard. |
65 * | 65 * |
66 * \param numkeys if non-NULL, receives the length of the returned array. | 66 * \param numkeys if non-NULL, receives the length of the returned array. |
67 * | 67 * |
68 * \return An array of key states. Indexes into this array are obtained by using ::SDL_ScanCode values. | 68 * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. |
69 * | 69 * |
70 * \b Example: | 70 * \b Example: |
71 * \code | 71 * \code |
72 * Uint8 *state = SDL_GetKeyboardState(NULL); | 72 * Uint8 *state = SDL_GetKeyboardState(NULL); |
73 * if ( state[SDL_SCANCODE_RETURN] ) { | 73 * if ( state[SDL_SCANCODE_RETURN] ) { |
78 extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); | 78 extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); |
79 | 79 |
80 /** | 80 /** |
81 * \brief Get the current key modifier state for the keyboard. | 81 * \brief Get the current key modifier state for the keyboard. |
82 */ | 82 */ |
83 extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); | 83 extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); |
84 | 84 |
85 /** | 85 /** |
86 * \brief Set the current key modifier state for the keyboard. | 86 * \brief Set the current key modifier state for the keyboard. |
87 * | 87 * |
88 * \note This does not change the keyboard state, only the key modifier flags. | 88 * \note This does not change the keyboard state, only the key modifier flags. |
89 */ | 89 */ |
90 extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); | 90 extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); |
91 | 91 |
92 /** | 92 /** |
93 * \brief Get the key code corresponding to the given scancode according | 93 * \brief Get the key code corresponding to the given scancode according |
94 * to the current keyboard layout. | 94 * to the current keyboard layout. |
95 * | 95 * |
96 * See ::SDLKey for details. | 96 * See ::SDL_Keycode for details. |
97 * | 97 * |
98 * \sa SDL_GetKeyName() | 98 * \sa SDL_GetKeyName() |
99 */ | 99 */ |
100 extern DECLSPEC SDLKey SDLCALL SDL_GetKeyFromScancode(SDL_ScanCode scancode); | 100 extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); |
101 | 101 |
102 /** | 102 /** |
103 * \brief Get the scancode corresponding to the given key code according to the | 103 * \brief Get the scancode corresponding to the given key code according to the |
104 * current keyboard layout. | 104 * current keyboard layout. |
105 * | 105 * |
106 * See ::SDL_ScanCode for details. | 106 * See ::SDL_Scancode for details. |
107 * | 107 * |
108 * \sa SDL_GetScancodeName() | 108 * \sa SDL_GetScancodeName() |
109 */ | 109 */ |
110 extern DECLSPEC SDL_ScanCode SDLCALL SDL_GetScancodeFromKey(SDLKey key); | 110 extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); |
111 | 111 |
112 /** | 112 /** |
113 * \brief Get a human-readable name for a scancode. | 113 * \brief Get a human-readable name for a scancode. |
114 * | 114 * |
115 * \return A pointer to a UTF-8 string that stays valid at least until the next | 115 * \return A pointer to a UTF-8 string that stays valid at least until the next |
116 * call to this function. If you need it around any longer, you must | 116 * call to this function. If you need it around any longer, you must |
117 * copy it. If the scancode doesn't have a name, this function returns | 117 * copy it. If the scancode doesn't have a name, this function returns |
118 * an empty string (""). | 118 * an empty string (""). |
119 * | 119 * |
120 * \sa SDL_ScanCode | 120 * \sa SDL_Scancode |
121 */ | 121 */ |
122 extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_ScanCode | 122 extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode |
123 scancode); | 123 scancode); |
124 | 124 |
125 /** | 125 /** |
126 * \brief Get a human-readable name for a key. | 126 * \brief Get a human-readable name for a key. |
127 * | 127 * |
128 * \return A pointer to a UTF-8 string that stays valid at least until the next | 128 * \return A pointer to a UTF-8 string that stays valid at least until the next |
129 * call to this function. If you need it around any longer, you must | 129 * call to this function. If you need it around any longer, you must |
130 * copy it. If the key doesn't have a name, this function returns an | 130 * copy it. If the key doesn't have a name, this function returns an |
131 * empty string (""). | 131 * empty string (""). |
132 * | 132 * |
133 * \sa SDLKey | 133 * \sa SDL_Key |
134 */ | 134 */ |
135 extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key); | 135 extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); |
136 | 136 |
137 /** | 137 /** |
138 * \brief Start accepting Unicode text input events. | 138 * \brief Start accepting Unicode text input events. |
139 * | 139 * |
140 * \sa SDL_StopTextInput() | 140 * \sa SDL_StopTextInput() |