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

Latest commit

 

History

History
170 lines (145 loc) · 4.81 KB

SDL_keyboard.h

File metadata and controls

170 lines (145 loc) · 4.81 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
/*
SDL - Simple DirectMedia Layer
Feb 12, 2011
Feb 12, 2011
3
Copyright (C) 1997-2011 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
/**
Oct 19, 2009
Oct 19, 2009
24
25
26
* \file SDL_keyboard.h
*
* Include file for SDL keyboard event handling
Jul 10, 2006
Jul 10, 2006
27
*/
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"
Feb 16, 2011
Feb 16, 2011
34
#include "SDL_keycode.h"
May 10, 2010
May 10, 2010
35
#include "SDL_video.h"
Apr 26, 2001
Apr 26, 2001
36
37
38
39
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
40
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
41
extern "C" {
Jul 10, 2006
Jul 10, 2006
42
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
43
44
#endif
Jul 10, 2006
Jul 10, 2006
45
/**
Oct 19, 2009
Oct 19, 2009
46
* \brief The SDL keysym structure, used in key events.
Apr 26, 2001
Apr 26, 2001
47
*/
Feb 7, 2011
Feb 7, 2011
48
typedef struct SDL_Keysym
Jul 10, 2006
Jul 10, 2006
49
{
Feb 7, 2011
Feb 7, 2011
50
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
Feb 7, 2011
Feb 7, 2011
51
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Jul 10, 2006
Jul 10, 2006
52
Uint16 mod; /**< current key modifiers */
Oct 19, 2009
Oct 19, 2009
53
Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */
Feb 7, 2011
Feb 7, 2011
54
} SDL_Keysym;
Apr 26, 2001
Apr 26, 2001
55
56
/* Function prototypes */
Jul 10, 2006
Jul 10, 2006
57
58
/**
May 10, 2010
May 10, 2010
59
* \brief Get the window which currently has keyboard focus.
Jul 10, 2006
Jul 10, 2006
60
*/
May 10, 2010
May 10, 2010
61
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
Jul 10, 2006
Jul 10, 2006
62
63
/**
May 10, 2010
May 10, 2010
64
* \brief Get a snapshot of the current state of the keyboard.
Oct 19, 2009
Oct 19, 2009
65
66
67
*
* \param numkeys if non-NULL, receives the length of the returned array.
*
Feb 7, 2011
Feb 7, 2011
68
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
Oct 19, 2009
Oct 19, 2009
69
70
71
72
73
74
75
76
*
* \b Example:
* \code
* Uint8 *state = SDL_GetKeyboardState(NULL);
* if ( state[SDL_SCANCODE_RETURN] ) {
* printf("<RETURN> is pressed.\n");
* }
* \endcode
Apr 26, 2001
Apr 26, 2001
77
*/
Feb 5, 2008
Feb 5, 2008
78
extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
Apr 26, 2001
Apr 26, 2001
79
Jul 10, 2006
Jul 10, 2006
80
/**
May 10, 2010
May 10, 2010
81
* \brief Get the current key modifier state for the keyboard.
Apr 26, 2001
Apr 26, 2001
82
*/
Feb 7, 2011
Feb 7, 2011
83
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
Apr 26, 2001
Apr 26, 2001
84
Jul 10, 2006
Jul 10, 2006
85
/**
May 10, 2010
May 10, 2010
86
* \brief Set the current key modifier state for the keyboard.
Oct 19, 2009
Oct 19, 2009
87
88
*
* \note This does not change the keyboard state, only the key modifier flags.
Apr 26, 2001
Apr 26, 2001
89
*/
Feb 7, 2011
Feb 7, 2011
90
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
Apr 26, 2001
Apr 26, 2001
91
Jul 10, 2006
Jul 10, 2006
92
/**
May 10, 2010
May 10, 2010
93
94
* \brief Get the key code corresponding to the given scancode according
* to the current keyboard layout.
Oct 19, 2009
Oct 19, 2009
95
*
Feb 7, 2011
Feb 7, 2011
96
* See ::SDL_Keycode for details.
Oct 19, 2009
Oct 19, 2009
97
98
*
* \sa SDL_GetKeyName()
Aug 19, 2007
Aug 19, 2007
99
*/
Feb 7, 2011
Feb 7, 2011
100
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
Aug 19, 2007
Aug 19, 2007
101
102
/**
Oct 19, 2009
Oct 19, 2009
103
104
105
* \brief Get the scancode corresponding to the given key code according to the
* current keyboard layout.
*
Feb 7, 2011
Feb 7, 2011
106
* See ::SDL_Scancode for details.
Oct 19, 2009
Oct 19, 2009
107
108
*
* \sa SDL_GetScancodeName()
Feb 5, 2008
Feb 5, 2008
109
*/
Feb 7, 2011
Feb 7, 2011
110
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
Feb 5, 2008
Feb 5, 2008
111
112
/**
Oct 19, 2009
Oct 19, 2009
113
114
115
116
117
118
119
* \brief Get a human-readable name for a scancode.
*
* \return A pointer to a UTF-8 string that stays valid at least until the next
* call to this function. If you need it around any longer, you must
* copy it. If the scancode doesn't have a name, this function returns
* an empty string ("").
*
Feb 7, 2011
Feb 7, 2011
120
* \sa SDL_Scancode
Feb 5, 2008
Feb 5, 2008
121
*/
Feb 7, 2011
Feb 7, 2011
122
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode
Feb 5, 2008
Feb 5, 2008
123
124
125
scancode);
/**
Oct 19, 2009
Oct 19, 2009
126
127
128
129
130
131
132
* \brief Get a human-readable name for a key.
*
* \return A pointer to a UTF-8 string that stays valid at least until the next
* call to this function. If you need it around any longer, you must
* copy it. If the key doesn't have a name, this function returns an
* empty string ("").
*
Feb 7, 2011
Feb 7, 2011
133
* \sa SDL_Key
Apr 26, 2001
Apr 26, 2001
134
*/
Feb 7, 2011
Feb 7, 2011
135
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
Apr 26, 2001
Apr 26, 2001
136
Sep 19, 2009
Sep 19, 2009
137
/**
Oct 19, 2009
Oct 19, 2009
138
139
140
141
* \brief Start accepting Unicode text input events.
*
* \sa SDL_StopTextInput()
* \sa SDL_SetTextInputRect()
Sep 19, 2009
Sep 19, 2009
142
143
144
145
*/
extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
/**
Oct 19, 2009
Oct 19, 2009
146
147
148
* \brief Stop receiving any text input events.
*
* \sa SDL_StartTextInput()
Sep 19, 2009
Sep 19, 2009
149
150
151
152
*/
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
/**
Oct 19, 2009
Oct 19, 2009
153
154
155
* \brief Set the rectangle used to type Unicode text inputs.
*
* \sa SDL_StartTextInput()
Sep 19, 2009
Sep 19, 2009
156
157
158
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
Apr 26, 2001
Apr 26, 2001
159
160
161
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
162
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
163
}
Jul 10, 2006
Jul 10, 2006
164
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
165
166
167
168
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */
Jul 10, 2006
Jul 10, 2006
169
170
/* vi: set ts=4 sw=4 expandtab: */