SDL  2.0
SDL_keycode.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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  *
42  * A special exception is the number keys at the top of the keyboard which
43  * always map to SDLK_0...SDLK_9, regardless of layout.
44  */
46 
47 #define SDLK_SCANCODE_MASK (1<<30)
48 #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
49 
50 typedef enum
51 {
53 
54  SDLK_RETURN = '\r',
55  SDLK_ESCAPE = '\033',
57  SDLK_TAB = '\t',
58  SDLK_SPACE = ' ',
59  SDLK_EXCLAIM = '!',
61  SDLK_HASH = '#',
62  SDLK_PERCENT = '%',
63  SDLK_DOLLAR = '$',
65  SDLK_QUOTE = '\'',
69  SDLK_PLUS = '+',
70  SDLK_COMMA = ',',
71  SDLK_MINUS = '-',
72  SDLK_PERIOD = '.',
73  SDLK_SLASH = '/',
74  SDLK_0 = '0',
75  SDLK_1 = '1',
76  SDLK_2 = '2',
77  SDLK_3 = '3',
78  SDLK_4 = '4',
79  SDLK_5 = '5',
80  SDLK_6 = '6',
81  SDLK_7 = '7',
82  SDLK_8 = '8',
83  SDLK_9 = '9',
84  SDLK_COLON = ':',
86  SDLK_LESS = '<',
87  SDLK_EQUALS = '=',
88  SDLK_GREATER = '>',
90  SDLK_AT = '@',
91 
92  /*
93  Skip uppercase letters
94  */
95 
99  SDLK_CARET = '^',
102  SDLK_a = 'a',
103  SDLK_b = 'b',
104  SDLK_c = 'c',
105  SDLK_d = 'd',
106  SDLK_e = 'e',
107  SDLK_f = 'f',
108  SDLK_g = 'g',
109  SDLK_h = 'h',
110  SDLK_i = 'i',
111  SDLK_j = 'j',
112  SDLK_k = 'k',
113  SDLK_l = 'l',
114  SDLK_m = 'm',
115  SDLK_n = 'n',
116  SDLK_o = 'o',
117  SDLK_p = 'p',
118  SDLK_q = 'q',
119  SDLK_r = 'r',
120  SDLK_s = 's',
121  SDLK_t = 't',
122  SDLK_u = 'u',
123  SDLK_v = 'v',
124  SDLK_w = 'w',
125  SDLK_x = 'x',
126  SDLK_y = 'y',
127  SDLK_z = 'z',
128 
130 
143 
150  SDLK_DELETE = '\177',
157 
175 
208 
221 
277 
286 
288 
306 
319 
322 } SDL_KeyCode;
323 
324 /**
325  * \brief Enumeration of valid key mods (possibly OR'd together).
326  */
327 typedef enum
328 {
329  KMOD_NONE = 0x0000,
330  KMOD_LSHIFT = 0x0001,
331  KMOD_RSHIFT = 0x0002,
332  KMOD_LCTRL = 0x0040,
333  KMOD_RCTRL = 0x0080,
334  KMOD_LALT = 0x0100,
335  KMOD_RALT = 0x0200,
336  KMOD_LGUI = 0x0400,
337  KMOD_RGUI = 0x0800,
338  KMOD_NUM = 0x1000,
339  KMOD_CAPS = 0x2000,
340  KMOD_MODE = 0x4000,
341  KMOD_RESERVED = 0x8000,
342 
347 } SDL_Keymod;
348 
349 #endif /* SDL_keycode_h_ */
350 
351 /* vi: set ts=4 sw=4 expandtab: */
SDL_KeyCode
Definition: SDL_keycode.h:50
Sint32 SDL_Keycode
The SDL virtual key representation.
Definition: SDL_keycode.h:45
#define SDL_SCANCODE_TO_KEYCODE(X)
Definition: SDL_keycode.h:48
int32_t Sint32
Definition: SDL_stdinc.h:203
SDL_Keymod
Enumeration of valid key mods (possibly OR&#39;d together).
Definition: SDL_keycode.h:327