46 * translation is enabled by the SDL_EnableUNICODE() API. If non-zero, |
46 * translation is enabled by the SDL_EnableUNICODE() API. If non-zero, |
47 * this is a UNICODE character corresponding to the keypress. If the |
47 * this is a UNICODE character corresponding to the keypress. If the |
48 * high 9 bits of the character are 0, then this maps to the equivalent |
48 * high 9 bits of the character are 0, then this maps to the equivalent |
49 * ASCII character: |
49 * ASCII character: |
50 * @code |
50 * @code |
51 * char ch; |
51 * char ch; |
52 * if ( (keysym.unicode & 0xFF80) == 0 ) { |
52 * if ( (keysym.unicode & 0xFF80) == 0 ) { |
53 * ch = keysym.unicode & 0x7F; |
53 * ch = keysym.unicode & 0x7F; |
54 * } else { |
54 * } else { |
55 * An international character.. |
55 * An international character.. |
56 * } |
56 * } |
57 * @endcode |
57 * @endcode |
58 */ |
58 */ |
59 typedef struct SDL_keysym { |
59 typedef struct SDL_keysym { |
60 Uint8 scancode; /**< hardware specific scancode */ |
60 Uint8 scancode; /**< hardware specific scancode */ |
61 SDLKey sym; /**< SDL virtual keysym */ |
61 SDLKey sym; /**< SDL virtual keysym */ |
62 SDLMod mod; /**< current key modifiers */ |
62 SDLMod mod; /**< current key modifiers */ |
63 Uint16 unicode; /**< translated character */ |
63 Uint16 unicode; /**< translated character */ |
64 } SDL_keysym; |
64 } SDL_keysym; |
65 |
65 |
66 /** This is the mask which refers to all hotkey bindings */ |
66 /** This is the mask which refers to all hotkey bindings */ |
67 #define SDL_ALL_HOTKEYS 0xFFFFFFFF |
67 #define SDL_ALL_HOTKEYS 0xFFFFFFFF |
68 |
68 |
69 /* Function prototypes */ |
69 /* Function prototypes */ |
70 /** |
70 /** |
71 * Enable/Disable UNICODE translation of keyboard input. |
71 * Enable/Disable UNICODE translation of keyboard input. |
72 * |
72 * |
79 * |
79 * |
80 * @return It returns the previous state of keyboard translation. |
80 * @return It returns the previous state of keyboard translation. |
81 */ |
81 */ |
82 extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); |
82 extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); |
83 |
83 |
84 #define SDL_DEFAULT_REPEAT_DELAY 500 |
84 #define SDL_DEFAULT_REPEAT_DELAY 500 |
85 #define SDL_DEFAULT_REPEAT_INTERVAL 30 |
85 #define SDL_DEFAULT_REPEAT_INTERVAL 30 |
86 /** |
86 /** |
87 * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. |
87 * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. |
88 * |
88 * |
89 * @param[in] delay |
89 * @param[in] delay |
90 * 'delay' is the initial delay in ms between the time when a key is |
90 * 'delay' is the initial delay in ms between the time when a key is |
100 |
100 |
101 /** |
101 /** |
102 * Get a snapshot of the current state of the keyboard. |
102 * Get a snapshot of the current state of the keyboard. |
103 * Returns an array of keystates, indexed by the SDLK_* syms. |
103 * Returns an array of keystates, indexed by the SDLK_* syms. |
104 * Usage: |
104 * Usage: |
105 * @code |
105 * @code |
106 * Uint8 *keystate = SDL_GetKeyState(NULL); |
106 * Uint8 *keystate = SDL_GetKeyState(NULL); |
107 * if ( keystate[SDLK_RETURN] ) //... \<RETURN> is pressed. |
107 * if ( keystate[SDLK_RETURN] ) //... \<RETURN> is pressed. |
108 * @endcode |
108 * @endcode |
109 */ |
109 */ |
110 extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); |
110 extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); |
111 |
111 |
112 /** |
112 /** |
113 * Get the current key modifier state |
113 * Get the current key modifier state |