~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to system/include/SDL/SDL_keyboard.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

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