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

Latest commit

 

History

History
169 lines (145 loc) · 4.88 KB

SDL_keyboard.h

File metadata and controls

169 lines (145 loc) · 4.88 KB
 
Apr 26, 2001
Apr 26, 2001
1
/*
Apr 8, 2011
Apr 8, 2011
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Apr 26, 2001
Apr 26, 2001
20
21
*/
Jul 10, 2006
Jul 10, 2006
22
/**
Oct 19, 2009
Oct 19, 2009
23
24
25
* \file SDL_keyboard.h
*
* Include file for SDL keyboard event handling
Jul 10, 2006
Jul 10, 2006
26
*/
Apr 26, 2001
Apr 26, 2001
27
28
29
30
#ifndef _SDL_keyboard_h
#define _SDL_keyboard_h
Feb 10, 2006
Feb 10, 2006
31
#include "SDL_stdinc.h"
Feb 10, 2006
Feb 10, 2006
32
#include "SDL_error.h"
Feb 16, 2011
Feb 16, 2011
33
#include "SDL_keycode.h"
May 10, 2010
May 10, 2010
34
#include "SDL_video.h"
Apr 26, 2001
Apr 26, 2001
35
36
37
38
#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
/**
Oct 19, 2009
Oct 19, 2009
45
* \brief The SDL keysym structure, used in key events.
Apr 26, 2001
Apr 26, 2001
46
*/
Feb 7, 2011
Feb 7, 2011
47
typedef struct SDL_Keysym
Jul 10, 2006
Jul 10, 2006
48
{
Feb 7, 2011
Feb 7, 2011
49
SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
Feb 7, 2011
Feb 7, 2011
50
SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Jul 10, 2006
Jul 10, 2006
51
Uint16 mod; /**< current key modifiers */
Oct 19, 2009
Oct 19, 2009
52
Uint32 unicode; /**< \deprecated use SDL_TextInputEvent instead */
Feb 7, 2011
Feb 7, 2011
53
} SDL_Keysym;
Apr 26, 2001
Apr 26, 2001
54
55
/* Function prototypes */
Jul 10, 2006
Jul 10, 2006
56
57
/**
May 10, 2010
May 10, 2010
58
* \brief Get the window which currently has keyboard focus.
Jul 10, 2006
Jul 10, 2006
59
*/
May 10, 2010
May 10, 2010
60
extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
Jul 10, 2006
Jul 10, 2006
61
62
/**
May 10, 2010
May 10, 2010
63
* \brief Get a snapshot of the current state of the keyboard.
Oct 19, 2009
Oct 19, 2009
64
65
66
*
* \param numkeys if non-NULL, receives the length of the returned array.
*
Feb 7, 2011
Feb 7, 2011
67
* \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values.
Oct 19, 2009
Oct 19, 2009
68
69
70
71
72
73
74
75
*
* \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
76
*/
Feb 5, 2008
Feb 5, 2008
77
extern DECLSPEC Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys);
Apr 26, 2001
Apr 26, 2001
78
Jul 10, 2006
Jul 10, 2006
79
/**
May 10, 2010
May 10, 2010
80
* \brief Get the current key modifier state for the keyboard.
Apr 26, 2001
Apr 26, 2001
81
*/
Feb 7, 2011
Feb 7, 2011
82
extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
Apr 26, 2001
Apr 26, 2001
83
Jul 10, 2006
Jul 10, 2006
84
/**
May 10, 2010
May 10, 2010
85
* \brief Set the current key modifier state for the keyboard.
Oct 19, 2009
Oct 19, 2009
86
87
*
* \note This does not change the keyboard state, only the key modifier flags.
Apr 26, 2001
Apr 26, 2001
88
*/
Feb 7, 2011
Feb 7, 2011
89
extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
Apr 26, 2001
Apr 26, 2001
90
Jul 10, 2006
Jul 10, 2006
91
/**
May 10, 2010
May 10, 2010
92
93
* \brief Get the key code corresponding to the given scancode according
* to the current keyboard layout.
Oct 19, 2009
Oct 19, 2009
94
*
Feb 7, 2011
Feb 7, 2011
95
* See ::SDL_Keycode for details.
Oct 19, 2009
Oct 19, 2009
96
97
*
* \sa SDL_GetKeyName()
Aug 19, 2007
Aug 19, 2007
98
*/
Feb 7, 2011
Feb 7, 2011
99
extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode);
Aug 19, 2007
Aug 19, 2007
100
101
/**
Oct 19, 2009
Oct 19, 2009
102
103
104
* \brief Get the scancode corresponding to the given key code according to the
* current keyboard layout.
*
Feb 7, 2011
Feb 7, 2011
105
* See ::SDL_Scancode for details.
Oct 19, 2009
Oct 19, 2009
106
107
*
* \sa SDL_GetScancodeName()
Feb 5, 2008
Feb 5, 2008
108
*/
Feb 7, 2011
Feb 7, 2011
109
extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
Feb 5, 2008
Feb 5, 2008
110
111
/**
Oct 19, 2009
Oct 19, 2009
112
113
114
115
116
117
118
* \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
119
* \sa SDL_Scancode
Feb 5, 2008
Feb 5, 2008
120
*/
Feb 7, 2011
Feb 7, 2011
121
extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode
Feb 5, 2008
Feb 5, 2008
122
123
124
scancode);
/**
Oct 19, 2009
Oct 19, 2009
125
126
127
128
129
130
131
* \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
132
* \sa SDL_Key
Apr 26, 2001
Apr 26, 2001
133
*/
Feb 7, 2011
Feb 7, 2011
134
extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
Apr 26, 2001
Apr 26, 2001
135
Sep 19, 2009
Sep 19, 2009
136
/**
Oct 19, 2009
Oct 19, 2009
137
138
139
140
* \brief Start accepting Unicode text input events.
*
* \sa SDL_StopTextInput()
* \sa SDL_SetTextInputRect()
Sep 19, 2009
Sep 19, 2009
141
142
143
144
*/
extern DECLSPEC void SDLCALL SDL_StartTextInput(void);
/**
Oct 19, 2009
Oct 19, 2009
145
146
147
* \brief Stop receiving any text input events.
*
* \sa SDL_StartTextInput()
Sep 19, 2009
Sep 19, 2009
148
149
150
151
*/
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
/**
Oct 19, 2009
Oct 19, 2009
152
153
154
* \brief Set the rectangle used to type Unicode text inputs.
*
* \sa SDL_StartTextInput()
Sep 19, 2009
Sep 19, 2009
155
156
157
*/
extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect);
Apr 26, 2001
Apr 26, 2001
158
159
160
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
Jul 10, 2006
Jul 10, 2006
161
/* *INDENT-OFF* */
Apr 26, 2001
Apr 26, 2001
162
}
Jul 10, 2006
Jul 10, 2006
163
/* *INDENT-ON* */
Apr 26, 2001
Apr 26, 2001
164
165
166
167
#endif
#include "close_code.h"
#endif /* _SDL_keyboard_h */
Jul 10, 2006
Jul 10, 2006
168
169
/* vi: set ts=4 sw=4 expandtab: */