comparison src/events/SDL_keyboard_c.h @ 4465:3e69e077cb95

Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API. Plus, this lets me start implementing cursor support.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 May 2010 20:47:22 -0700
parents 5c64052fb476
children 95352c671a6e
comparison
equal deleted inserted replaced
4464:fa77a6429698 4465:3e69e077cb95
25 #define _SDL_keyboard_c_h 25 #define _SDL_keyboard_c_h
26 26
27 #include "SDL_keysym.h" 27 #include "SDL_keysym.h"
28 #include "SDL_events.h" 28 #include "SDL_events.h"
29 29
30 typedef struct SDL_Keyboard SDL_Keyboard;
31
32 struct SDL_Keyboard
33 {
34 /* Free the keyboard when it's time */
35 void (*FreeKeyboard) (SDL_Keyboard * keyboard);
36
37 /* Data common to all keyboards */
38 SDL_Window *focus;
39 Uint16 modstate;
40 Uint8 keystate[SDL_NUM_SCANCODES];
41 SDLKey keymap[SDL_NUM_SCANCODES];
42
43 void *driverdata;
44 };
45
46 /* Initialize the keyboard subsystem */ 30 /* Initialize the keyboard subsystem */
47 extern int SDL_KeyboardInit(void); 31 extern int SDL_KeyboardInit(void);
48 32
49 /* Get the keyboard at an index */ 33 /* Clear the state of the keyboard */
50 extern SDL_Keyboard *SDL_GetKeyboard(int index); 34 extern void SDL_ResetKeyboard(void);
51
52 /* Add a keyboard, possibly reattaching at a particular index (or -1),
53 returning the index of the keyboard, or -1 if there was an error.
54 */
55 extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index);
56
57 /* Remove a keyboard at an index, clearing the slot for later */
58 extern void SDL_DelKeyboard(int index);
59
60 /* Clear the state of a keyboard at an index */
61 extern void SDL_ResetKeyboard(int index);
62 35
63 /* Get the default keymap */ 36 /* Get the default keymap */
64 extern void SDL_GetDefaultKeymap(SDLKey * keymap); 37 extern void SDL_GetDefaultKeymap(SDLKey * keymap);
65 38
66 /* Set the mapping of scancode to key codes for this keyboard */ 39 /* Set the mapping of scancode to key codes */
67 extern void SDL_SetKeymap(int index, int start, SDLKey * keys, int length); 40 extern void SDL_SetKeymap(int start, SDLKey * keys, int length);
68 41
69 /* Set a platform-dependent key name, overriding the default platform-agnostic 42 /* Set a platform-dependent key name, overriding the default platform-agnostic
70 name. Encoded as UTF-8. The string is not copied, thus the pointer given to 43 name. Encoded as UTF-8. The string is not copied, thus the pointer given to
71 this function must stay valid forever (or at least until the call to 44 this function must stay valid forever (or at least until the call to
72 VideoQuit()). */ 45 VideoQuit()). */
73 extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name); 46 extern void SDL_SetScancodeName(SDL_scancode scancode, const char *name);
74 47
75 /* Set the keyboard focus window */ 48 /* Set the keyboard focus window */
76 extern void SDL_SetKeyboardFocus(int index, SDL_Window * window); 49 extern void SDL_SetKeyboardFocus(SDL_Window * window);
77 50
78 /* Send a keyboard event for a keyboard at an index */ 51 /* Send a keyboard key event */
79 extern int SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode); 52 extern int SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode);
80 53
81 /* Send keyboard text input for a keyboard at an index */ 54 /* Send keyboard text input */
82 extern int SDL_SendKeyboardText(int index, const char *text); 55 extern int SDL_SendKeyboardText(const char *text);
83 56
84 /* Send editing text for selected range from start to end */ 57 /* Send editing text for selected range from start to end */
85 extern int SDL_SendEditingText(int index, const char *text, int start, int end); 58 extern int SDL_SendEditingText(const char *text, int start, int end);
86 59
87 /* Shutdown the keyboard subsystem */ 60 /* Shutdown the keyboard subsystem */
88 extern void SDL_KeyboardQuit(void); 61 extern void SDL_KeyboardQuit(void);
89 62
90 #endif /* _SDL_keyboard_c_h */ 63 #endif /* _SDL_keyboard_c_h */