SDL  2.0
SDL_keycode.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2016 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_keycode.h
24  *
25  * Defines constants which identify keyboard keys and modifiers.
26  */
27 
28 #ifndef _SDL_keycode_h
29 #define _SDL_keycode_h
30 
31 #include "SDL_stdinc.h"
32 #include "SDL_scancode.h"
33 
34 /**
35  * \brief The SDL virtual key representation.
36  *
37  * Values of this type are used to represent keyboard keys using the current
38  * layout of the keyboard. These values include Unicode values representing
39  * the unmodified character that would be generated by pressing the key, or
40  * an SDLK_* constant for those keys that do not generate characters.
41  */
43 
44 #define SDLK_SCANCODE_MASK (1<<30)
45 #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
46 
47 enum
48 {
50 
51  SDLK_RETURN = '\r',
52  SDLK_ESCAPE = '\033',
54  SDLK_TAB = '\t',
55  SDLK_SPACE = ' ',
56  SDLK_EXCLAIM = '!',
58  SDLK_HASH = '#',
59  SDLK_PERCENT = '%',
60  SDLK_DOLLAR = '$',
62  SDLK_QUOTE = '\'',
66  SDLK_PLUS = '+',
67  SDLK_COMMA = ',',
68  SDLK_MINUS = '-',
69  SDLK_PERIOD = '.',
70  SDLK_SLASH = '/',
71  SDLK_0 = '0',
72  SDLK_1 = '1',
73  SDLK_2 = '2',
74  SDLK_3 = '3',
75  SDLK_4 = '4',
76  SDLK_5 = '5',
77  SDLK_6 = '6',
78  SDLK_7 = '7',
79  SDLK_8 = '8',
80  SDLK_9 = '9',
81  SDLK_COLON = ':',
83  SDLK_LESS = '<',
84  SDLK_EQUALS = '=',
85  SDLK_GREATER = '>',
87  SDLK_AT = '@',
88  /*
89  Skip uppercase letters
90  */
94  SDLK_CARET = '^',
97  SDLK_a = 'a',
98  SDLK_b = 'b',
99  SDLK_c = 'c',
100  SDLK_d = 'd',
101  SDLK_e = 'e',
102  SDLK_f = 'f',
103  SDLK_g = 'g',
104  SDLK_h = 'h',
105  SDLK_i = 'i',
106  SDLK_j = 'j',
107  SDLK_k = 'k',
108  SDLK_l = 'l',
109  SDLK_m = 'm',
110  SDLK_n = 'n',
111  SDLK_o = 'o',
112  SDLK_p = 'p',
113  SDLK_q = 'q',
114  SDLK_r = 'r',
115  SDLK_s = 's',
116  SDLK_t = 't',
117  SDLK_u = 'u',
118  SDLK_v = 'v',
119  SDLK_w = 'w',
120  SDLK_x = 'x',
121  SDLK_y = 'y',
122  SDLK_z = 'z',
123 
125 
138 
145  SDLK_DELETE = '\177',
152 
170 
203 
216 
272 
281 
283 
301 
312 };
313 
314 /**
315  * \brief Enumeration of valid key mods (possibly OR'd together).
316  */
317 typedef enum
318 {
319  KMOD_NONE = 0x0000,
320  KMOD_LSHIFT = 0x0001,
321  KMOD_RSHIFT = 0x0002,
322  KMOD_LCTRL = 0x0040,
323  KMOD_RCTRL = 0x0080,
324  KMOD_LALT = 0x0100,
325  KMOD_RALT = 0x0200,
326  KMOD_LGUI = 0x0400,
327  KMOD_RGUI = 0x0800,
328  KMOD_NUM = 0x1000,
329  KMOD_CAPS = 0x2000,
330  KMOD_MODE = 0x4000,
331  KMOD_RESERVED = 0x8000
332 } SDL_Keymod;
333 
334 #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
335 #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
336 #define KMOD_ALT (KMOD_LALT|KMOD_RALT)
337 #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI)
338 
339 #endif /* _SDL_keycode_h */
340 
341 /* vi: set ts=4 sw=4 expandtab: */
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:42
#define SDL_SCANCODE_TO_KEYCODE(X)
Definition: SDL_keycode.h:45
int32_t Sint32
Definition: SDL_stdinc.h:157
SDL_Keymod
Enumeration of valid key mods (possibly OR&#39;d together).
Definition: SDL_keycode.h:317