comparison include/SDL_keyboard.h @ 1662:782fd950bd46 SDL-1.3

Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API. WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid. The code is now run through a consistent indent format: indent -i4 -nut -nsc -br -ce The headers are being converted to automatically generate doxygen documentation.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 28 May 2006 13:04:16 +0000
parents 1ff64ad478b2
children 4da1ee79c9af
comparison
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 /* Include file for SDL keyboard event handling */ 23 /**
24 * \file SDL_keyboard.h
25 *
26 * Include file for SDL keyboard event handling
27 */
24 28
25 #ifndef _SDL_keyboard_h 29 #ifndef _SDL_keyboard_h
26 #define _SDL_keyboard_h 30 #define _SDL_keyboard_h
27 31
28 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
30 #include "SDL_keysym.h" 34 #include "SDL_keysym.h"
31 35
32 #include "begin_code.h" 36 #include "begin_code.h"
33 /* Set up for C function definitions, even when using C++ */ 37 /* Set up for C function definitions, even when using C++ */
34 #ifdef __cplusplus 38 #ifdef __cplusplus
39 /* *INDENT-OFF* */
35 extern "C" { 40 extern "C" {
41 /* *INDENT-ON* */
36 #endif 42 #endif
37 43
38 /* Keysym structure 44 /* Keysym structure
39 - The scancode is hardware dependent, and should not be used by general 45 - The scancode is hardware dependent, and should not be used by general
40 applications. If no hardware scancode is available, it will be 0. 46 applications. If no hardware scancode is available, it will be 0.
49 ch = keysym.unicode & 0x7F; 55 ch = keysym.unicode & 0x7F;
50 } else { 56 } else {
51 An international character.. 57 An international character..
52 } 58 }
53 */ 59 */
54 typedef struct SDL_keysym { 60 typedef struct SDL_keysym
55 Uint8 scancode; /* hardware specific scancode */ 61 {
56 SDLKey sym; /* SDL virtual keysym */ 62 Uint8 scancode; /* hardware specific scancode */
57 SDLMod mod; /* current key modifiers */ 63 SDLKey sym; /* SDL virtual keysym */
58 Uint16 unicode; /* translated character */ 64 SDLMod mod; /* current key modifiers */
65 Uint16 unicode; /* translated character */
59 } SDL_keysym; 66 } SDL_keysym;
60 67
61 /* This is the mask which refers to all hotkey bindings */ 68 /* This is the mask which refers to all hotkey bindings */
62 #define SDL_ALL_HOTKEYS 0xFFFFFFFF 69 #define SDL_ALL_HOTKEYS 0xFFFFFFFF
63 70
68 * If 'enable' is 1, translation is enabled. 75 * If 'enable' is 1, translation is enabled.
69 * If 'enable' is 0, translation is disabled. 76 * If 'enable' is 0, translation is disabled.
70 * If 'enable' is -1, the translation state is not changed. 77 * If 'enable' is -1, the translation state is not changed.
71 * It returns the previous state of keyboard translation. 78 * It returns the previous state of keyboard translation.
72 */ 79 */
73 extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); 80 extern DECLSPEC int SDLCALL SDL_EnableUNICODE (int enable);
74 81
75 /* 82 /*
76 * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. 83 * Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
77 * 'delay' is the initial delay in ms between the time when a key is 84 * 'delay' is the initial delay in ms between the time when a key is
78 * pressed, and keyboard repeat begins. 85 * pressed, and keyboard repeat begins.
81 #define SDL_DEFAULT_REPEAT_DELAY 500 88 #define SDL_DEFAULT_REPEAT_DELAY 500
82 #define SDL_DEFAULT_REPEAT_INTERVAL 30 89 #define SDL_DEFAULT_REPEAT_INTERVAL 30
83 /* 90 /*
84 * If 'delay' is set to 0, keyboard repeat is disabled. 91 * If 'delay' is set to 0, keyboard repeat is disabled.
85 */ 92 */
86 extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); 93 extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat (int delay, int interval);
87 extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); 94 extern DECLSPEC void SDLCALL SDL_GetKeyRepeat (int *delay, int *interval);
88 95
89 /* 96 /*
90 * Get a snapshot of the current state of the keyboard. 97 * Get a snapshot of the current state of the keyboard.
91 * Returns an array of keystates, indexed by the SDLK_* syms. 98 * Returns an array of keystates, indexed by the SDLK_* syms.
92 * Used: 99 * Used:
93 * Uint8 *keystate = SDL_GetKeyState(NULL); 100 * Uint8 *keystate = SDL_GetKeyState(NULL);
94 * if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed. 101 * if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
95 */ 102 */
96 extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); 103 extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyState (int *numkeys);
97 104
98 /* 105 /*
99 * Get the current key modifier state 106 * Get the current key modifier state
100 */ 107 */
101 extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); 108 extern DECLSPEC SDLMod SDLCALL SDL_GetModState (void);
102 109
103 /* 110 /*
104 * Set the current key modifier state 111 * Set the current key modifier state
105 * This does not change the keyboard state, only the key modifier flags. 112 * This does not change the keyboard state, only the key modifier flags.
106 */ 113 */
107 extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); 114 extern DECLSPEC void SDLCALL SDL_SetModState (SDLMod modstate);
108 115
109 /* 116 /*
110 * Get the name of an SDL virtual keysym 117 * Get the name of an SDL virtual keysym
111 */ 118 */
112 extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); 119 extern DECLSPEC char *SDLCALL SDL_GetKeyName (SDLKey key);
113 120
114 121
115 /* Ends C function definitions when using C++ */ 122 /* Ends C function definitions when using C++ */
116 #ifdef __cplusplus 123 #ifdef __cplusplus
124 /* *INDENT-OFF* */
117 } 125 }
126 /* *INDENT-ON* */
118 #endif 127 #endif
119 #include "close_code.h" 128 #include "close_code.h"
120 129
121 #endif /* _SDL_keyboard_h */ 130 #endif /* _SDL_keyboard_h */
131
132 /* vi: set ts=4 sw=4 expandtab: */