comparison src/events/SDL_keyboard_c.h @ 2303:d87417504c75

First pass implementation of new SDL scancode concept, as discussed with Christian Walther. Currently only implemented on Mac OS X for sanity checking purposes.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 05 Feb 2008 07:19:23 +0000
parents c97ad1abe05b
children 47f8a579cd9b
comparison
equal deleted inserted replaced
2302:7ae1c419b626 2303:d87417504c75
35 void (*FreeKeyboard) (SDL_Keyboard * keyboard); 35 void (*FreeKeyboard) (SDL_Keyboard * keyboard);
36 36
37 /* Data common to all keyboards */ 37 /* Data common to all keyboards */
38 SDL_WindowID focus; 38 SDL_WindowID focus;
39 Uint16 modstate; 39 Uint16 modstate;
40 Uint8 keystate[SDLK_LAST]; 40 Uint8 keystate[(SDL_NUM_SCANCODES + 7) / 8];
41 SDLKey keymap[SDL_NUM_SCANCODES];
41 42
42 void *driverdata; 43 void *driverdata;
43 }; 44 };
44
45 /* Used by the OS keyboard code to detect whether or not to do UNICODE */
46 #ifndef DEFAULT_UNICODE_TRANSLATION
47 #define DEFAULT_UNICODE_TRANSLATION 0 /* Default off because of overhead */
48 #endif
49 extern int SDL_TranslateUNICODE;
50
51 /* convert UCS4 to utf8 */
52 extern char *SDL_Ucs4ToUtf8(Uint32 ch, char *dst);
53 45
54 /* Initialize the keyboard subsystem */ 46 /* Initialize the keyboard subsystem */
55 extern int SDL_KeyboardInit(void); 47 extern int SDL_KeyboardInit(void);
56 48
57 /* Get the keyboard at an index */ 49 /* Get the keyboard at an index */
66 extern void SDL_DelKeyboard(int index); 58 extern void SDL_DelKeyboard(int index);
67 59
68 /* Clear the state of a keyboard at an index */ 60 /* Clear the state of a keyboard at an index */
69 extern void SDL_ResetKeyboard(int index); 61 extern void SDL_ResetKeyboard(int index);
70 62
63 /* Get the default keymap */
64 extern void SDL_GetDefaultKeymap(SDLKey * keymap);
65
66 /* Set the mapping of scancode to key codes for this keyboard */
67 extern void SDL_SetKeymap(int index, int start, SDLKey * keys, int length);
68
71 /* Set a platform-dependent key name, overriding the default platform-agnostic 69 /* Set a platform-dependent key name, overriding the default platform-agnostic
72 name. Encoded as UTF-8. The string is not copied, thus the pointer given to 70 name. Encoded as UTF-8. The string is not copied, thus the pointer given to
73 this function must stay valid forever (or at least until the call to 71 this function must stay valid forever (or at least until the call to
74 VideoQuit()). */ 72 VideoQuit()). */
75 extern void SDL_SetKeyName(SDLKey physicalKey, const char *name); 73 extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name);
76 74
77 /* Set the keyboard focus window */ 75 /* Set the keyboard focus window */
78 extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID); 76 extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID);
79 77
80 /* Send a keyboard event for a keyboard at an index */ 78 /* Send a keyboard event for a keyboard at an index */
81 extern int SDL_SendKeyboardKey(int index, Uint8 state, Uint8 scancode, 79 extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode);
82 SDLKey key);
83 80
84 /* Send keyboard text input for a keyboard at an index */ 81 /* Send keyboard text input for a keyboard at an index */
85 extern int SDL_SendKeyboardText(int index, const char *text); 82 extern int SDL_SendKeyboardText(int index, const char *text);
86 83
87 /* Shutdown the keyboard subsystem */ 84 /* Shutdown the keyboard subsystem */