kick
|
00001 // 00002 // key_input.h 00003 // UnitTest_KickCPP 00004 // 00005 // Created by morten on 24/04/14. 00006 // 00007 // 00008 #pragma once 00009 00010 #include "kick/core/key_input_enum.h" 00011 #include <set> 00012 #include <vector> 00013 #include <initializer_list> 00014 00015 namespace kick { 00016 00017 enum class Key{ 00018 UNKNOWN = SDLK_UNKNOWN,//0, 00019 RETURN = SDLK_RETURN,//'\r', 00020 ESCAPE = SDLK_ESCAPE,//'\033', 00021 BACKSPACE = SDLK_BACKSPACE,//'\b', 00022 TAB = SDLK_TAB,//'\t', 00023 SPACE = SDLK_SPACE,//' ', 00024 EXCLAIM = SDLK_EXCLAIM,//'!', 00025 QUOTEDBL = SDLK_QUOTEDBL,//'"', 00026 HASH = SDLK_HASH,//'#', 00027 PERCENT = SDLK_PERCENT,//'%', 00028 DOLLAR = SDLK_DOLLAR,//'$', 00029 AMPERSAND = SDLK_AMPERSAND,//'&', 00030 QUOTE = SDLK_QUOTE,//'\'', 00031 LEFTPAREN = SDLK_LEFTPAREN,//'(', 00032 RIGHTPAREN = SDLK_RIGHTPAREN,//')', 00033 ASTERISK = SDLK_ASTERISK,//'*', 00034 PLUS = SDLK_PLUS,//'+', 00035 COMMA = SDLK_COMMA,//',', 00036 MINUS = SDLK_MINUS,//'-', 00037 PERIOD = SDLK_PERIOD,//'.', 00038 SLASH = SDLK_SLASH,//'/', 00039 NUM_0 = SDLK_0,//'0', 00040 NUM_1 = SDLK_1,//'1', 00041 NUM_2 = SDLK_2,//'2', 00042 NUM_3 = SDLK_3,//'3', 00043 NUM_4 = SDLK_4,//'4', 00044 NUM_5 = SDLK_5,//'5', 00045 NUM_6 = SDLK_6,//'6', 00046 NUM_7 = SDLK_7,//'7', 00047 NUM_8 = SDLK_8,//'8', 00048 NUM_9 = SDLK_9,//'9', 00049 COLON = SDLK_COLON,//':', 00050 SEMICOLON = SDLK_SEMICOLON,//';', 00051 LESS = SDLK_LESS,//'<', 00052 EQUALS = SDLK_EQUALS,//'=', 00053 GREATER = SDLK_GREATER,//'>', 00054 QUESTION = SDLK_QUESTION,//'?', 00055 AT = SDLK_AT,//'@', 00056 /* 00057 Skip uppercase letters 00058 */ 00059 LEFTBRACKET = SDLK_LEFTBRACKET,//'[', 00060 BACKSLASH = SDLK_BACKSLASH,//'\\', 00061 RIGHTBRACKET = SDLK_RIGHTBRACKET,//']', 00062 CARET = SDLK_CARET,//'^', 00063 UNDERSCORE = SDLK_UNDERSCORE,//'_', 00064 BACKQUOTE = SDLK_BACKQUOTE,//'`', 00065 a = SDLK_a,//'a', 00066 b = SDLK_b,//'b', 00067 c = SDLK_c,//'c', 00068 d = SDLK_d,//'d', 00069 e = SDLK_e,//'e', 00070 f = SDLK_f,//'f', 00071 g = SDLK_g,//'g', 00072 h = SDLK_h,//'h', 00073 i = SDLK_i,//'i', 00074 j = SDLK_j,//'j', 00075 k = SDLK_k,//'k', 00076 l = SDLK_l,//'l', 00077 m = SDLK_m,//'m', 00078 n = SDLK_n,//'n', 00079 o = SDLK_o,//'o', 00080 p = SDLK_p,//'p', 00081 q = SDLK_q,//'q', 00082 r = SDLK_r,//'r', 00083 s = SDLK_s,//'s', 00084 t = SDLK_t,//'t', 00085 u = SDLK_u,//'u', 00086 v = SDLK_v,//'v', 00087 w = SDLK_w,//'w', 00088 x = SDLK_x,//'x', 00089 y = SDLK_y,//'y', 00090 z = SDLK_z,//'z', 00091 00092 CAPSLOCK = SDLK_CAPSLOCK,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), 00093 00094 F1 = SDLK_F1,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), 00095 F2 = SDLK_F2,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), 00096 F3 = SDLK_F3,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), 00097 F4 = SDLK_F4,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), 00098 F5 = SDLK_F5,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), 00099 F6 = SDLK_F6,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), 00100 F7 = SDLK_F7,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), 00101 F8 = SDLK_F8,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), 00102 F9 = SDLK_F9,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), 00103 F10 = SDLK_F10,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), 00104 F11 = SDLK_F11,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), 00105 F12 = SDLK_F12,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), 00106 00107 PRINTSCREEN = SDLK_PRINTSCREEN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), 00108 SCROLLLOCK = SDLK_SCROLLLOCK,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), 00109 PAUSE = SDLK_PAUSE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), 00110 INSERT = SDLK_INSERT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), 00111 HOME = SDLK_HOME,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), 00112 PAGEUP = SDLK_PAGEUP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), 00113 DELETE = SDLK_DELETE,//'\177', 00114 END = SDLK_END,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), 00115 PAGEDOWN = SDLK_PAGEDOWN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), 00116 RIGHT = SDLK_RIGHT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), 00117 LEFT = SDLK_LEFT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), 00118 DOWN = SDLK_DOWN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), 00119 UP = SDLK_UP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), 00120 00121 NUMLOCKCLEAR = SDLK_NUMLOCKCLEAR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), 00122 KP_DIVIDE = SDLK_KP_DIVIDE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), 00123 KP_MULTIPLY = SDLK_KP_MULTIPLY,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), 00124 KP_MINUS = SDLK_KP_MINUS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), 00125 KP_PLUS = SDLK_KP_PLUS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), 00126 KP_ENTER = SDLK_KP_ENTER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), 00127 KP_1 = SDLK_KP_1,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), 00128 KP_2 = SDLK_KP_2,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), 00129 KP_3 = SDLK_KP_3,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), 00130 KP_4 = SDLK_KP_4,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), 00131 KP_5 = SDLK_KP_5,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), 00132 KP_6 = SDLK_KP_6,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), 00133 KP_7 = SDLK_KP_7,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), 00134 KP_8 = SDLK_KP_8,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), 00135 KP_9 = SDLK_KP_9,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), 00136 KP_0 = SDLK_KP_0,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), 00137 KP_PERIOD = SDLK_KP_PERIOD,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), 00138 00139 APPLICATION = SDLK_APPLICATION,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), 00140 POWER = SDLK_POWER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), 00141 KP_EQUALS = SDLK_KP_EQUALS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), 00142 F13 = SDLK_F13,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), 00143 F14 = SDLK_F14,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), 00144 F15 = SDLK_F15,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), 00145 F16 = SDLK_F16,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), 00146 F17 = SDLK_F17,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), 00147 F18 = SDLK_F18,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), 00148 F19 = SDLK_F19,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), 00149 F20 = SDLK_F20,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), 00150 F21 = SDLK_F21,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), 00151 F22 = SDLK_F22,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), 00152 F23 = SDLK_F23,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), 00153 F24 = SDLK_F24,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), 00154 EXECUTE = SDLK_EXECUTE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), 00155 HELP = SDLK_HELP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), 00156 MENU = SDLK_MENU,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), 00157 SELECT = SDLK_SELECT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), 00158 STOP = SDLK_STOP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), 00159 AGAIN = SDLK_AGAIN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), 00160 UNDO = SDLK_UNDO,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), 00161 CUT = SDLK_CUT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), 00162 COPY = SDLK_COPY,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), 00163 PASTE = SDLK_PASTE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), 00164 FIND = SDLK_FIND,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), 00165 MUTE = SDLK_MUTE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), 00166 VOLUMEUP = SDLK_VOLUMEUP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), 00167 VOLUMEDOWN = SDLK_VOLUMEDOWN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), 00168 KP_COMMA = SDLK_KP_COMMA,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), 00169 KP_EQUALSAS400 =SDLK_KP_EQUALSAS400,// 00170 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), 00171 00172 ALTERASE = SDLK_ALTERASE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), 00173 SYSREQ = SDLK_SYSREQ,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), 00174 CANCEL = SDLK_CANCEL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), 00175 CLEAR = SDLK_CLEAR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), 00176 PRIOR = SDLK_PRIOR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), 00177 RETURN2 = SDLK_RETURN2,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), 00178 SEPARATOR = SDLK_SEPARATOR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), 00179 OUT = SDLK_OUT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), 00180 OPER = SDLK_OPER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), 00181 CLEARAGAIN = SDLK_CLEARAGAIN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), 00182 CRSEL = SDLK_CRSEL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), 00183 EXSEL = SDLK_EXSEL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), 00184 00185 KP_00 = SDLK_KP_00,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), 00186 KP_000 = SDLK_KP_000,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), 00187 THOUSANDSSEPARATOR =SDLK_THOUSANDSSEPARATOR,// 00188 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), 00189 DECIMALSEPARATOR =SDLK_DECIMALSEPARATOR,// 00190 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), 00191 CURRENCYUNIT = SDLK_CURRENCYUNIT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), 00192 CURRENCYSUBUNIT =SDLK_CURRENCYSUBUNIT,// 00193 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), 00194 KP_LEFTPAREN = SDLK_KP_LEFTPAREN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), 00195 KP_RIGHTPAREN = SDLK_KP_RIGHTPAREN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), 00196 KP_LEFTBRACE = SDLK_KP_LEFTBRACE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), 00197 KP_RIGHTBRACE = SDLK_KP_RIGHTBRACE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), 00198 KP_TAB = SDLK_KP_TAB,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), 00199 KP_BACKSPACE = SDLK_KP_BACKSPACE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), 00200 KP_A = SDLK_KP_A,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), 00201 KP_B = SDLK_KP_B,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), 00202 KP_C = SDLK_KP_C,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), 00203 KP_D = SDLK_KP_D,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), 00204 KP_E = SDLK_KP_E,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), 00205 KP_F = SDLK_KP_F,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), 00206 KP_XOR = SDLK_KP_XOR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), 00207 KP_POWER = SDLK_KP_POWER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), 00208 KP_PERCENT = SDLK_KP_PERCENT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), 00209 KP_LESS = SDLK_KP_LESS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), 00210 KP_GREATER = SDLK_KP_GREATER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), 00211 KP_AMPERSAND = SDLK_KP_AMPERSAND,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), 00212 KP_DBLAMPERSAND =SDLK_KP_DBLAMPERSAND,// 00213 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), 00214 KP_VERTICALBAR =SDLK_KP_VERTICALBAR,// 00215 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), 00216 KP_DBLVERTICALBAR =SDLK_KP_DBLVERTICALBAR,// 00217 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), 00218 KP_COLON = SDLK_KP_COLON,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), 00219 KP_HASH = SDLK_KP_HASH,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), 00220 KP_SPACE = SDLK_KP_SPACE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), 00221 KP_AT = SDLK_KP_AT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), 00222 KP_EXCLAM = SDLK_KP_EXCLAM,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), 00223 KP_MEMSTORE = SDLK_KP_MEMSTORE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), 00224 KP_MEMRECALL = SDLK_KP_MEMRECALL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), 00225 KP_MEMCLEAR = SDLK_KP_MEMCLEAR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), 00226 KP_MEMADD = SDLK_KP_MEMADD,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), 00227 KP_MEMSUBTRACT =SDLK_KP_MEMSUBTRACT,// 00228 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), 00229 KP_MEMMULTIPLY =SDLK_KP_MEMMULTIPLY,// 00230 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), 00231 KP_MEMDIVIDE = SDLK_KP_MEMDIVIDE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), 00232 KP_PLUSMINUS = SDLK_KP_PLUSMINUS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), 00233 KP_CLEAR = SDLK_KP_CLEAR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), 00234 KP_CLEARENTRY = SDLK_KP_CLEARENTRY,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), 00235 KP_BINARY = SDLK_KP_BINARY,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), 00236 KP_OCTAL = SDLK_KP_OCTAL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), 00237 KP_DECIMAL = SDLK_KP_DECIMAL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), 00238 KP_HEXADECIMAL =SDLK_KP_HEXADECIMAL,// 00239 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), 00240 00241 LCTRL = SDLK_LCTRL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), 00242 LSHIFT = SDLK_LSHIFT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), 00243 LALT = SDLK_LALT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), 00244 LGUI = SDLK_LGUI,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), 00245 RCTRL = SDLK_RCTRL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), 00246 RSHIFT = SDLK_RSHIFT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), 00247 RALT = SDLK_RALT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), 00248 RGUI = SDLK_RGUI,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), 00249 00250 MODE = SDLK_MODE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), 00251 00252 AUDIONEXT = SDLK_AUDIONEXT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), 00253 AUDIOPREV = SDLK_AUDIOPREV,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), 00254 AUDIOSTOP = SDLK_AUDIOSTOP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), 00255 AUDIOPLAY = SDLK_AUDIOPLAY,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), 00256 AUDIOMUTE = SDLK_AUDIOMUTE,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), 00257 MEDIASELECT = SDLK_MEDIASELECT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), 00258 WWW = SDLK_WWW,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), 00259 MAIL = SDLK_MAIL,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), 00260 CALCULATOR = SDLK_CALCULATOR,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), 00261 COMPUTER = SDLK_COMPUTER,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), 00262 AC_SEARCH = SDLK_AC_SEARCH,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), 00263 AC_HOME = SDLK_AC_HOME,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), 00264 AC_BACK = SDLK_AC_BACK,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), 00265 AC_FORWARD = SDLK_AC_FORWARD,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), 00266 AC_STOP = SDLK_AC_STOP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), 00267 AC_REFRESH = SDLK_AC_REFRESH,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), 00268 AC_BOOKMARKS = SDLK_AC_BOOKMARKS,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), 00269 00270 BRIGHTNESSDOWN =SDLK_BRIGHTNESSDOWN,// 00271 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), 00272 BRIGHTNESSUP = SDLK_BRIGHTNESSUP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), 00273 DISPLAYSWITCH = SDLK_DISPLAYSWITCH,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), 00274 KBDILLUMTOGGLE =SDLK_KBDILLUMTOGGLE,// 00275 // SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), 00276 KBDILLUMDOWN = SDLK_KBDILLUMDOWN,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), 00277 KBDILLUMUP = SDLK_KBDILLUMUP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), 00278 EJECT = SDLK_EJECT,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), 00279 SLEEP = SDLK_SLEEP,//SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) 00280 }; 00281 00282 struct KeyMapping { 00283 public: 00284 KeyMapping(std::initializer_list<Key> keys); 00285 KeyMapping(std::initializer_list<KeyMapping> alternatives); 00286 std::vector<Key> keys; 00287 std::vector<KeyMapping> alternatives; 00288 }; 00289 00290 class KeyInput { 00291 public: 00293 static void reset(); 00294 static bool down(Key button); 00295 static bool pressed(Key button); 00296 static bool up(Key button); 00297 static bool down(const KeyMapping& mapping); 00298 // if all keys in keymapping is pressed and at least one key is pressed down this frame) 00299 static bool pressed(const KeyMapping& mapping); 00300 static bool anyDown(); 00301 static bool anyUp(); 00302 static bool anyPressed(); 00303 00304 static void pressBegin(Key k); 00305 static void pressEnd(Key k); 00306 00307 static const std::set<Key> & buttonsDown(); 00308 static const std::set<Key> & buttonsPressed(); 00309 static const std::set<Key> & buttonsUp(); 00310 private: 00311 KeyInput() = delete; 00312 static std::set<Key> buttonDown; 00313 static std::set<Key> buttonPressed; 00314 static std::set<Key> buttonUp; 00315 00316 00317 }; 00318 }