annotate src/events/SDL_keyboard_c.h @ 1673:624e1412fbba SDL-1.3

Keyboard code update in progress
author Sam Lantinga <slouken@libsdl.org>
date Sat, 10 Jun 2006 09:11:59 +0000
parents
children 7688a73b25b1
rev   line source
1673
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #ifndef _SDL_keyboard_c_h
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #define _SDL_keyboard_c_h
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 typedef struct SDL_Keyboard SDL_Keyboard;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 struct SDL_Keyboard
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 {
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 /* Free the keyboard when it's time */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 void (*FreeKeyboard) (SDL_Keyboard * keyboard);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 SDLMod modstate;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 Uint8 keystate[SDLK_LAST];
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 struct
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 {
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 int firsttime; /* if we check against the delay or repeat value */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 int delay; /* the delay before we start repeating */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 int interval; /* the delay between key repeat events */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 Uint32 timestamp; /* the time the first keydown event occurred */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 SDL_Event evt; /* the event we are supposed to repeat */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 } keyrepeat;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 void *driverdata;
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 };
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 /* Initialize the keyboard subsystem */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 extern int SDL_KeyboardInit(void);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 /* Get the keyboard at an index */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 extern SDL_Keyboard *SDL_GetKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 /* Add a keyboard, possibly reattaching at a particular index (or -1),
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 returning the index of the keyboard, or -1 if there was an error.
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 /* Remove a keyboard at an index, clearing the slot for later */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 extern void SDL_DelKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 /* Clear the state of a keyboard at an index */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 extern void SDL_ResetKeyboard(int index);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 /* Send a keyboard event for a keyboard at an index */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 extern int SDL_SendKeyboardKey(int index, Uint8 state,
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 const SDL_keysym * keysym);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 /* Shutdown the keyboard subsystem */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 extern void SDL_KeyboardQuit(void);
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 #endif /* _SDL_keyboard_c_h */
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76
624e1412fbba Keyboard code update in progress
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 /* vi: set ts=4 sw=4 expandtab: */