Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
168 lines (145 loc) · 4.65 KB

SDL_keyboard.h

File metadata and controls

168 lines (145 loc) · 4.65 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Feb 1, 2006
Feb 1, 2006
3
Copyright (C) 1997-2006 Sam Lantinga
Apr 26, 2001
Apr 26, 2001
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
Apr 26, 2001
Apr 26, 2001
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
Apr 26, 2001
Apr 26, 2001
9
10
11
12
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Apr 26, 2001
Apr 26, 2001
14
Feb 1, 2006
Feb 1, 2006
15
16
17
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Apr 26, 2001
Apr 26, 2001
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Apr 26, 2001
Apr 26, 2001
21
22
*/
Jul 10, 2006
Jul 10, 2006
23
24
25
26
27
/**
* \file SDL_keyboard.h
*
* Include file for SDL keyboard event handling
*/
Apr 26, 2001
Apr 26, 2001
28
29
30
31
#ifndef _SDL_keyboard_h
#define _SDL_keyboard_h
Feb 10, 2006
Feb 10, 2006
32
#include "SDL_stdinc.h"
Feb 10, 2006
Feb 10, 2006
33
#include "SDL_error.h"
Apr 26, 2001
Apr 26, 2001
34
35
36
37
38
#include "SDL_keysym.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
39
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
40
extern "C" {
Jul 10, 2006
Jul 10, 2006
41
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
42
43
#endif
Jul 10, 2006
Jul 10, 2006
44
45
46
47
/**
* \struct SDL_keysym
*
* \brief The SDL keysym structure, used in key events.
Apr 26, 2001
Apr 26, 2001
48
*/
Jul 10, 2006
Jul 10, 2006
49
50
51
52
53
54
55
typedef struct SDL_keysym
{
Uint8 scancode; /**< keyboard specific scancode */
Uint8 padding[3]; /**< alignment padding */
Uint16 sym; /**< SDL virtual keysym */
Uint16 mod; /**< current key modifiers */
Uint32 unicode; /**< OBSOLETE, use SDL_TextInputEvent instead */
Apr 26, 2001
Apr 26, 2001
56
57
58
} SDL_keysym;
/* Function prototypes */
Jul 10, 2006
Jul 10, 2006
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* \fn int SDL_GetNumKeyboards(void)
*
* \brief Get the number of keyboard input devices available.
*
* \sa SDL_SelectKeyboard()
*/
extern DECLSPEC int SDLCALL SDL_GetNumKeyboards(void);
/**
* \fn int SDL_SelectKeyboard(int index)
*
* \brief Set the index of the currently selected keyboard.
*
* \return The index of the previously selected keyboard.
*
* \note You can query the currently selected keyboard by passing an index of -1.
*
* \sa SDL_GetNumKeyboards()
*/
extern DECLSPEC int SDLCALL SDL_SelectKeyboard(int index);
/**
* \fn int SDL_EnableUNICODE(int enable)
*
* \brief Enable/Disable UNICODE translation of keyboard input.
*
* \param enable 1 to enable translation, 0 to disable translation, -1 to query translation
*
* \return The previous state of keyboard translation
*
* \note This translation has some overhead, so translation defaults off.
Apr 26, 2001
Apr 26, 2001
92
*/
Apr 11, 2002
Apr 11, 2002
93
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
Apr 26, 2001
Apr 26, 2001
94
Jul 10, 2006
Jul 10, 2006
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* \fn int SDL_EnableKeyRepeat(int delay, int interval)
*
* \brief Enable keyboard repeat for the selected keyboard.
*
* \param delay The initial delay in milliseconds between the time when a
* key is pressed and keyboard repeat begins. Setting a delay
* of 0 will disable keyboard repeat.
* \param interval The time in milliseconds between keyboard repeat events.
*
* \return 0 on success, or -1 if there was an error.
*
* \note Keyboard repeat defaults to off.
Apr 26, 2001
Apr 26, 2001
108
109
110
*/
#define SDL_DEFAULT_REPEAT_DELAY 500
#define SDL_DEFAULT_REPEAT_INTERVAL 30
Jul 10, 2006
Jul 10, 2006
111
112
113
114
115
116
117
/**/
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
/**
* \fn void SDL_GetKeyRepeat(int *delay, int *interval)
*
* \brief Get the current keyboard repeat setting for the selected keyboard.
Apr 26, 2001
Apr 26, 2001
118
*/
Mar 13, 2006
Mar 13, 2006
119
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
Apr 26, 2001
Apr 26, 2001
120
Jul 10, 2006
Jul 10, 2006
121
122
123
124
125
126
127
128
/**
* \fn Uint8 *SDL_GetKeyState(int *numkeys)
*
* \brief Get a snapshot of the current state of the selected keyboard.
*
* \return An array of keystates, indexed by the SDLK_* syms.
*
* Example:
Apr 26, 2001
Apr 26, 2001
129
130
131
* Uint8 *keystate = SDL_GetKeyState(NULL);
* if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed.
*/
Jul 10, 2006
Jul 10, 2006
132
extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyState(int *numkeys);
Apr 26, 2001
Apr 26, 2001
133
Jul 10, 2006
Jul 10, 2006
134
135
136
137
/**
* \fn SDLMod SDL_GetModState(void)
*
* \brief Get the current key modifier state for the selected keyboard.
Apr 26, 2001
Apr 26, 2001
138
*/
Apr 11, 2002
Apr 11, 2002
139
extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
Apr 26, 2001
Apr 26, 2001
140
Jul 10, 2006
Jul 10, 2006
141
142
143
144
145
146
/**
* \fn void SDL_SetModState(SDLMod modstate)
*
* \brief Set the current key modifier state for the selected keyboard.
*
* \note This does not change the keyboard state, only the key modifier flags.
Apr 26, 2001
Apr 26, 2001
147
*/
Apr 11, 2002
Apr 11, 2002
148
extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
Apr 26, 2001
Apr 26, 2001
149
Jul 10, 2006
Jul 10, 2006
150
151
152
153
/**
* \fn const char *SDL_GetKeyName(SDLKey key)
*
* \brief Get the name of an SDL virtual keysym
Apr 26, 2001
Apr 26, 2001
154
*/
Jul 10, 2006
Jul 10, 2006
155
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDLKey key);
Apr 26, 2001
Apr 26, 2001
156
157
158
159
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
160
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
161
}
Jul 10, 2006
Jul 10, 2006
162
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
163
164
165
166
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */
Jul 10, 2006
Jul 10, 2006
167
168
/* vi: set ts=4 sw=4 expandtab: */