ST_engine  0.3-ALPHA
key_definitions.hpp
1 /* This file is part of the "ST" project.
2  * You may use, distribute or modify this code under the terms
3  * of the GNU General Public License version 2.
4  * See LICENCE.txt in the root directory of the project.
5  *
6  * Author: Maxim Atanasov
7  * E-mail: maxim.atanasov@protonmail.com
8  */
9 
10 #ifndef KEY_DEFINITIONS_HPP
11 #define KEY_DEFINITIONS_HPP
12 
13 #include <cstdint>
14 #include <SDL_scancode.h>
15 
16 //This is where the key to toggle the console is defined
17 #define CONSOLE_TOGGLE_KEY '`'
18 
19 namespace ST {
20 
22  //SDL_SCANCODE values are used for almost all keys. This should be portable, but whether that's true is unknown.
23  enum class key : uint8_t {
24  UNKNOWN = SDL_SCANCODE_UNKNOWN,
25 
26  //1 - 3 is unused in SDL_scancodes.h so we can use it to store mouse inputs
27  MOUSELEFT = 1,
28  MOUSEMIDDLE = 2,
29  MOUSERIGHT = 3,
30 
31  LEFT = SDL_SCANCODE_LEFT,
32  RIGHT = SDL_SCANCODE_RIGHT,
33  UP = SDL_SCANCODE_UP,
34  DOWN = SDL_SCANCODE_DOWN,
35  A = SDL_SCANCODE_A,
36  B = SDL_SCANCODE_B,
37  C = SDL_SCANCODE_C,
38  D = SDL_SCANCODE_D,
39  E = SDL_SCANCODE_E,
40  F = SDL_SCANCODE_F,
41  G = SDL_SCANCODE_G,
42  H = SDL_SCANCODE_H,
43  I = SDL_SCANCODE_I,
44  J = SDL_SCANCODE_J,
45  K = SDL_SCANCODE_K,
46  L = SDL_SCANCODE_L,
47  M = SDL_SCANCODE_M,
48  N = SDL_SCANCODE_N,
49  O = SDL_SCANCODE_O,
50  P = SDL_SCANCODE_P,
51  Q = SDL_SCANCODE_Q,
52  R = SDL_SCANCODE_R,
53  S = SDL_SCANCODE_S,
54  T = SDL_SCANCODE_T,
55  V = SDL_SCANCODE_V,
56  U = SDL_SCANCODE_U,
57  W = SDL_SCANCODE_W,
58  X = SDL_SCANCODE_X,
59  Y = SDL_SCANCODE_Y,
60  Z = SDL_SCANCODE_Z,
61  ONE = SDL_SCANCODE_1,
62  TWO = SDL_SCANCODE_2,
63  THREE = SDL_SCANCODE_3,
64  FOUR = SDL_SCANCODE_4,
65  FIVE = SDL_SCANCODE_5,
66  SIX = SDL_SCANCODE_6,
67  SEVEN = SDL_SCANCODE_7,
68  EIGHT = SDL_SCANCODE_8,
69  NINE = SDL_SCANCODE_9,
70  ZERO = SDL_SCANCODE_0,
71  ESCAPE = SDL_SCANCODE_ESCAPE,
72  ENTER = SDL_SCANCODE_RETURN,
73  SPACEBAR = SDL_SCANCODE_SPACE,
74  TILDE = SDL_SCANCODE_GRAVE,
75  LSHIFT = SDL_SCANCODE_LSHIFT,
76  BACKSPACE = SDL_SCANCODE_BACKSPACE,
77  BACKSLASH = SDL_SCANCODE_BACKSLASH,
78  CAPSLOCK = SDL_SCANCODE_CAPSLOCK,
79  COMMA = SDL_SCANCODE_COMMA,
80  EQUALS = SDL_SCANCODE_EQUALS,
81  LALT = SDL_SCANCODE_LALT,
82  LCTRL = SDL_SCANCODE_LCTRL,
83  LBRACKET = SDL_SCANCODE_LEFTBRACKET,
84  RBRACKET = SDL_SCANCODE_RIGHTBRACKET,
85  MINUS = SDL_SCANCODE_MINUS,
86  RALT = SDL_SCANCODE_RALT,
87  RCTRL = SDL_SCANCODE_RCTRL,
88  SEMICOLON = SDL_SCANCODE_SEMICOLON,
89  SLASH = SDL_SCANCODE_SLASH,
90  TAB = SDL_SCANCODE_TAB,
91  DELETE = SDL_SCANCODE_DELETE,
92 
93  //Range from 153 to 166 in SDL_scancode.h is irrelevant to us, so we can use it to store these vars
94  CONTROLLER_BUTTON_A = 153,
95  CONTROLLER_BUTTON_B = 154,
96  CONTROLLER_BUTTON_X = 155,
97  CONTROLLER_BUTTON_Y = 156,
98  CONTROLLER_BUTTON_SELECT = 157,
99  CONTROLLER_BUTTON_START = 158,
100  CONTROLLER_BUTTON_LEFTSTICK = 159,
101  CONTROLLER_BUTTON_RIGHTSTICK = 160,
102  CONTROLLER_BUTTON_LEFTSHOULDER = 161,
103  CONTROLLER_BUTTON_RIGHTSHOULDER = 162,
104  CONTROLLER_BUTTON_DPAD_UP = 163,
105  CONTROLLER_BUTTON_DPAD_DOWN = 164,
106  CONTROLLER_BUTTON_DPAD_LEFT = 165,
107  CONTROLLER_BUTTON_DPAD_RIGHT = 166,
108  CONTROLLER_BUTTON_LEFT_TRIGGER = 167,
109  CONTROLLER_BUTTON_RIGHT_TRIGGER = 168,
110  };
111 }
112 
113 #endif //KEY_DEFINITIONS_HPP