Keyboard.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /**
  2. * Copyright (c) 2006-2023 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #include "common/config.h"
  21. #include "Keyboard.h"
  22. namespace love
  23. {
  24. namespace keyboard
  25. {
  26. bool Keyboard::getConstant(const char *in, Key &out)
  27. {
  28. return keys.find(in, out);
  29. }
  30. bool Keyboard::getConstant(Key in, const char *&out)
  31. {
  32. return keys.find(in, out);
  33. }
  34. bool Keyboard::getConstant(const char *in, Scancode &out)
  35. {
  36. return scancodes.find(in, out);
  37. }
  38. bool Keyboard::getConstant(Scancode in, const char *&out)
  39. {
  40. return scancodes.find(in, out);
  41. }
  42. bool Keyboard::getConstant(const char *in, ModifierKey &out)
  43. {
  44. return modifiers.find(in, out);
  45. }
  46. bool Keyboard::getConstant(ModifierKey in, const char *&out)
  47. {
  48. return modifiers.find(in, out);
  49. }
  50. StringMap<Keyboard::Key, Keyboard::KEY_MAX_ENUM>::Entry Keyboard::keyEntries[] =
  51. {
  52. {"unknown", Keyboard::KEY_UNKNOWN},
  53. {"return", Keyboard::KEY_RETURN},
  54. {"escape", Keyboard::KEY_ESCAPE},
  55. {"backspace", Keyboard::KEY_BACKSPACE},
  56. {"tab", Keyboard::KEY_TAB},
  57. {"space", Keyboard::KEY_SPACE},
  58. {"!", Keyboard::KEY_EXCLAIM},
  59. {"\"", Keyboard::KEY_QUOTEDBL},
  60. {"#", Keyboard::KEY_HASH},
  61. {"%", Keyboard::KEY_PERCENT},
  62. {"$", Keyboard::KEY_DOLLAR},
  63. {"&", Keyboard::KEY_AMPERSAND},
  64. {"'", Keyboard::KEY_QUOTE},
  65. {"(", Keyboard::KEY_LEFTPAREN},
  66. {")", Keyboard::KEY_RIGHTPAREN},
  67. {"*", Keyboard::KEY_ASTERISK},
  68. {"+", Keyboard::KEY_PLUS},
  69. {",", Keyboard::KEY_COMMA},
  70. {"-", Keyboard::KEY_MINUS},
  71. {".", Keyboard::KEY_PERIOD},
  72. {"/", Keyboard::KEY_SLASH},
  73. {"0", Keyboard::KEY_0},
  74. {"1", Keyboard::KEY_1},
  75. {"2", Keyboard::KEY_2},
  76. {"3", Keyboard::KEY_3},
  77. {"4", Keyboard::KEY_4},
  78. {"5", Keyboard::KEY_5},
  79. {"6", Keyboard::KEY_6},
  80. {"7", Keyboard::KEY_7},
  81. {"8", Keyboard::KEY_8},
  82. {"9", Keyboard::KEY_9},
  83. {":", Keyboard::KEY_COLON},
  84. {";", Keyboard::KEY_SEMICOLON},
  85. {"<", Keyboard::KEY_LESS},
  86. {"=", Keyboard::KEY_EQUALS},
  87. {">", Keyboard::KEY_GREATER},
  88. {"?", Keyboard::KEY_QUESTION},
  89. {"@", Keyboard::KEY_AT},
  90. {"[", Keyboard::KEY_LEFTBRACKET},
  91. {"\\", Keyboard::KEY_BACKSLASH},
  92. {"]", Keyboard::KEY_RIGHTBRACKET},
  93. {"^", Keyboard::KEY_CARET},
  94. {"_", Keyboard::KEY_UNDERSCORE},
  95. {"`", Keyboard::KEY_BACKQUOTE},
  96. {"a", Keyboard::KEY_A},
  97. {"b", Keyboard::KEY_B},
  98. {"c", Keyboard::KEY_C},
  99. {"d", Keyboard::KEY_D},
  100. {"e", Keyboard::KEY_E},
  101. {"f", Keyboard::KEY_F},
  102. {"g", Keyboard::KEY_G},
  103. {"h", Keyboard::KEY_H},
  104. {"i", Keyboard::KEY_I},
  105. {"j", Keyboard::KEY_J},
  106. {"k", Keyboard::KEY_K},
  107. {"l", Keyboard::KEY_L},
  108. {"m", Keyboard::KEY_M},
  109. {"n", Keyboard::KEY_N},
  110. {"o", Keyboard::KEY_O},
  111. {"p", Keyboard::KEY_P},
  112. {"q", Keyboard::KEY_Q},
  113. {"r", Keyboard::KEY_R},
  114. {"s", Keyboard::KEY_S},
  115. {"t", Keyboard::KEY_T},
  116. {"u", Keyboard::KEY_U},
  117. {"v", Keyboard::KEY_V},
  118. {"w", Keyboard::KEY_W},
  119. {"x", Keyboard::KEY_X},
  120. {"y", Keyboard::KEY_Y},
  121. {"z", Keyboard::KEY_Z},
  122. {"capslock", Keyboard::KEY_CAPSLOCK},
  123. {"f1", Keyboard::KEY_F1},
  124. {"f2", Keyboard::KEY_F2},
  125. {"f3", Keyboard::KEY_F3},
  126. {"f4", Keyboard::KEY_F4},
  127. {"f5", Keyboard::KEY_F5},
  128. {"f6", Keyboard::KEY_F6},
  129. {"f7", Keyboard::KEY_F7},
  130. {"f8", Keyboard::KEY_F8},
  131. {"f9", Keyboard::KEY_F9},
  132. {"f10", Keyboard::KEY_F10},
  133. {"f11", Keyboard::KEY_F11},
  134. {"f12", Keyboard::KEY_F12},
  135. {"printscreen", Keyboard::KEY_PRINTSCREEN},
  136. {"scrolllock", Keyboard::KEY_SCROLLLOCK},
  137. {"pause", Keyboard::KEY_PAUSE},
  138. {"insert", Keyboard::KEY_INSERT},
  139. {"home", Keyboard::KEY_HOME},
  140. {"pageup", Keyboard::KEY_PAGEUP},
  141. {"delete", Keyboard::KEY_DELETE},
  142. {"end", Keyboard::KEY_END},
  143. {"pagedown", Keyboard::KEY_PAGEDOWN},
  144. {"right", Keyboard::KEY_RIGHT},
  145. {"left", Keyboard::KEY_LEFT},
  146. {"down", Keyboard::KEY_DOWN},
  147. {"up", Keyboard::KEY_UP},
  148. {"numlock", Keyboard::KEY_NUMLOCKCLEAR},
  149. {"kp/", Keyboard::KEY_KP_DIVIDE},
  150. {"kp*", Keyboard::KEY_KP_MULTIPLY},
  151. {"kp-", Keyboard::KEY_KP_MINUS},
  152. {"kp+", Keyboard::KEY_KP_PLUS},
  153. {"kpenter", Keyboard::KEY_KP_ENTER},
  154. {"kp0", Keyboard::KEY_KP_0},
  155. {"kp1", Keyboard::KEY_KP_1},
  156. {"kp2", Keyboard::KEY_KP_2},
  157. {"kp3", Keyboard::KEY_KP_3},
  158. {"kp4", Keyboard::KEY_KP_4},
  159. {"kp5", Keyboard::KEY_KP_5},
  160. {"kp6", Keyboard::KEY_KP_6},
  161. {"kp7", Keyboard::KEY_KP_7},
  162. {"kp8", Keyboard::KEY_KP_8},
  163. {"kp9", Keyboard::KEY_KP_9},
  164. {"kp.", Keyboard::KEY_KP_PERIOD},
  165. {"kp,", Keyboard::KEY_KP_COMMA},
  166. {"kp=", Keyboard::KEY_KP_EQUALS},
  167. {"application", Keyboard::KEY_APPLICATION},
  168. {"power", Keyboard::KEY_POWER},
  169. {"f13", Keyboard::KEY_F13},
  170. {"f14", Keyboard::KEY_F14},
  171. {"f15", Keyboard::KEY_F15},
  172. {"f16", Keyboard::KEY_F16},
  173. {"f17", Keyboard::KEY_F17},
  174. {"f18", Keyboard::KEY_F18},
  175. {"f19", Keyboard::KEY_F19},
  176. {"f20", Keyboard::KEY_F20},
  177. {"f21", Keyboard::KEY_F21},
  178. {"f22", Keyboard::KEY_F22},
  179. {"f23", Keyboard::KEY_F23},
  180. {"f24", Keyboard::KEY_F24},
  181. {"execute", Keyboard::KEY_EXECUTE},
  182. {"help", Keyboard::KEY_HELP},
  183. {"menu", Keyboard::KEY_MENU},
  184. {"select", Keyboard::KEY_SELECT},
  185. {"stop", Keyboard::KEY_STOP},
  186. {"again", Keyboard::KEY_AGAIN},
  187. {"undo", Keyboard::KEY_UNDO},
  188. {"cut", Keyboard::KEY_CUT},
  189. {"copy", Keyboard::KEY_COPY},
  190. {"paste", Keyboard::KEY_PASTE},
  191. {"find", Keyboard::KEY_FIND},
  192. {"mute", Keyboard::KEY_MUTE},
  193. {"volumeup", Keyboard::KEY_VOLUMEUP},
  194. {"volumedown", Keyboard::KEY_VOLUMEDOWN},
  195. {"alterase", Keyboard::KEY_ALTERASE},
  196. {"sysreq", Keyboard::KEY_SYSREQ},
  197. {"cancel", Keyboard::KEY_CANCEL},
  198. {"clear", Keyboard::KEY_CLEAR},
  199. {"prior", Keyboard::KEY_PRIOR},
  200. {"return2", Keyboard::KEY_RETURN2},
  201. {"separator", Keyboard::KEY_SEPARATOR},
  202. {"out", Keyboard::KEY_OUT},
  203. {"oper", Keyboard::KEY_OPER},
  204. {"clearagain", Keyboard::KEY_CLEARAGAIN},
  205. {"thousandsseparator", Keyboard::KEY_THOUSANDSSEPARATOR},
  206. {"decimalseparator", Keyboard::KEY_DECIMALSEPARATOR},
  207. {"currencyunit", Keyboard::KEY_CURRENCYUNIT},
  208. {"currencysubunit", Keyboard::KEY_CURRENCYSUBUNIT},
  209. {"lctrl", Keyboard::KEY_LCTRL},
  210. {"lshift", Keyboard::KEY_LSHIFT},
  211. {"lalt", Keyboard::KEY_LALT},
  212. {"lgui", Keyboard::KEY_LGUI},
  213. {"rctrl", Keyboard::KEY_RCTRL},
  214. {"rshift", Keyboard::KEY_RSHIFT},
  215. {"ralt", Keyboard::KEY_RALT},
  216. {"rgui", Keyboard::KEY_RGUI},
  217. {"mode", Keyboard::KEY_MODE},
  218. {"audionext", Keyboard::KEY_AUDIONEXT},
  219. {"audioprev", Keyboard::KEY_AUDIOPREV},
  220. {"audiostop", Keyboard::KEY_AUDIOSTOP},
  221. {"audioplay", Keyboard::KEY_AUDIOPLAY},
  222. {"audiomute", Keyboard::KEY_AUDIOMUTE},
  223. {"mediaselect", Keyboard::KEY_MEDIASELECT},
  224. {"www", Keyboard::KEY_WWW},
  225. {"mail", Keyboard::KEY_MAIL},
  226. {"calculator", Keyboard::KEY_CALCULATOR},
  227. {"computer", Keyboard::KEY_COMPUTER},
  228. {"appsearch", Keyboard::KEY_APP_SEARCH},
  229. {"apphome", Keyboard::KEY_APP_HOME},
  230. {"appback", Keyboard::KEY_APP_BACK},
  231. {"appforward", Keyboard::KEY_APP_FORWARD},
  232. {"appstop", Keyboard::KEY_APP_STOP},
  233. {"apprefresh", Keyboard::KEY_APP_REFRESH},
  234. {"appbookmarks", Keyboard::KEY_APP_BOOKMARKS},
  235. {"brightnessdown", Keyboard::KEY_BRIGHTNESSDOWN},
  236. {"brightnessup", Keyboard::KEY_BRIGHTNESSUP},
  237. {"displayswitch", Keyboard::KEY_DISPLAYSWITCH},
  238. {"kbdillumtoggle", Keyboard::KEY_KBDILLUMTOGGLE},
  239. {"kbdillumdown", Keyboard::KEY_KBDILLUMDOWN},
  240. {"kbdillumup", Keyboard::KEY_KBDILLUMUP},
  241. {"eject", Keyboard::KEY_EJECT},
  242. {"sleep", Keyboard::KEY_SLEEP},
  243. };
  244. StringMap<Keyboard::Key, Keyboard::KEY_MAX_ENUM> Keyboard::keys(Keyboard::keyEntries, sizeof(Keyboard::keyEntries));
  245. StringMap<Keyboard::Scancode, Keyboard::SCANCODE_MAX_ENUM>::Entry Keyboard::scancodeEntries[] =
  246. {
  247. {"unknown", SCANCODE_UNKNOWN},
  248. {"a", SCANCODE_A},
  249. {"b", SCANCODE_B},
  250. {"c", SCANCODE_C},
  251. {"d", SCANCODE_D},
  252. {"e", SCANCODE_E},
  253. {"f", SCANCODE_F},
  254. {"g", SCANCODE_G},
  255. {"h", SCANCODE_H},
  256. {"i", SCANCODE_I},
  257. {"j", SCANCODE_J},
  258. {"k", SCANCODE_K},
  259. {"l", SCANCODE_L},
  260. {"m", SCANCODE_M},
  261. {"n", SCANCODE_N},
  262. {"o", SCANCODE_O},
  263. {"p", SCANCODE_P},
  264. {"q", SCANCODE_Q},
  265. {"r", SCANCODE_R},
  266. {"s", SCANCODE_S},
  267. {"t", SCANCODE_T},
  268. {"u", SCANCODE_U},
  269. {"v", SCANCODE_V},
  270. {"w", SCANCODE_W},
  271. {"x", SCANCODE_X},
  272. {"y", SCANCODE_Y},
  273. {"z", SCANCODE_Z},
  274. {"1", SCANCODE_1},
  275. {"2", SCANCODE_2},
  276. {"3", SCANCODE_3},
  277. {"4", SCANCODE_4},
  278. {"5", SCANCODE_5},
  279. {"6", SCANCODE_6},
  280. {"7", SCANCODE_7},
  281. {"8", SCANCODE_8},
  282. {"9", SCANCODE_9},
  283. {"0", SCANCODE_0},
  284. {"return", SCANCODE_RETURN},
  285. {"escape", SCANCODE_ESCAPE},
  286. {"backspace", SCANCODE_BACKSPACE},
  287. {"tab", SCANCODE_TAB},
  288. {"space", SCANCODE_SPACE},
  289. {"-", SCANCODE_MINUS},
  290. {"=", SCANCODE_EQUALS},
  291. {"[", SCANCODE_LEFTBRACKET},
  292. {"]", SCANCODE_RIGHTBRACKET},
  293. {"\\", SCANCODE_BACKSLASH},
  294. {"nonus#", SCANCODE_NONUSHASH},
  295. {";", SCANCODE_SEMICOLON},
  296. {"'", SCANCODE_APOSTROPHE},
  297. {"`", SCANCODE_GRAVE},
  298. {",", SCANCODE_COMMA},
  299. {".", SCANCODE_PERIOD},
  300. {"/", SCANCODE_SLASH},
  301. {"capslock", SCANCODE_CAPSLOCK},
  302. {"f1", SCANCODE_F1},
  303. {"f2", SCANCODE_F2},
  304. {"f3", SCANCODE_F3},
  305. {"f4", SCANCODE_F4},
  306. {"f5", SCANCODE_F5},
  307. {"f6", SCANCODE_F6},
  308. {"f7", SCANCODE_F7},
  309. {"f8", SCANCODE_F8},
  310. {"f9", SCANCODE_F9},
  311. {"f10", SCANCODE_F10},
  312. {"f11", SCANCODE_F11},
  313. {"f12", SCANCODE_F12},
  314. {"printscreen", SCANCODE_PRINTSCREEN},
  315. {"scrolllock", SCANCODE_SCROLLLOCK},
  316. {"pause", SCANCODE_PAUSE},
  317. {"insert", SCANCODE_INSERT},
  318. {"home", SCANCODE_HOME},
  319. {"pageup", SCANCODE_PAGEUP},
  320. {"delete", SCANCODE_DELETE},
  321. {"end", SCANCODE_END},
  322. {"pagedown", SCANCODE_PAGEDOWN},
  323. {"right", SCANCODE_RIGHT},
  324. {"left", SCANCODE_LEFT},
  325. {"down", SCANCODE_DOWN},
  326. {"up", SCANCODE_UP},
  327. {"numlock", SCANCODE_NUMLOCKCLEAR},
  328. {"kp/", SCANCODE_KP_DIVIDE},
  329. {"kp*", SCANCODE_KP_MULTIPLY},
  330. {"kp-", SCANCODE_KP_MINUS},
  331. {"kp+", SCANCODE_KP_PLUS},
  332. {"kpenter", SCANCODE_KP_ENTER},
  333. {"kp1", SCANCODE_KP_1},
  334. {"kp2", SCANCODE_KP_2},
  335. {"kp3", SCANCODE_KP_3},
  336. {"kp4", SCANCODE_KP_4},
  337. {"kp5", SCANCODE_KP_5},
  338. {"kp6", SCANCODE_KP_6},
  339. {"kp7", SCANCODE_KP_7},
  340. {"kp8", SCANCODE_KP_8},
  341. {"kp9", SCANCODE_KP_9},
  342. {"kp0", SCANCODE_KP_0},
  343. {"kp.", SCANCODE_KP_PERIOD},
  344. {"nonusbackslash", SCANCODE_NONUSBACKSLASH},
  345. {"application", SCANCODE_APPLICATION},
  346. {"power", SCANCODE_POWER},
  347. {"kp=", SCANCODE_KP_EQUALS},
  348. {"f13", SCANCODE_F13},
  349. {"f14", SCANCODE_F14},
  350. {"f15", SCANCODE_F15},
  351. {"f16", SCANCODE_F16},
  352. {"f17", SCANCODE_F17},
  353. {"f18", SCANCODE_F18},
  354. {"f19", SCANCODE_F19},
  355. {"f20", SCANCODE_F20},
  356. {"f21", SCANCODE_F21},
  357. {"f22", SCANCODE_F22},
  358. {"f23", SCANCODE_F23},
  359. {"f24", SCANCODE_F24},
  360. {"execute", SCANCODE_EXECUTE},
  361. {"help", SCANCODE_HELP},
  362. {"menu", SCANCODE_MENU},
  363. {"select", SCANCODE_SELECT},
  364. {"stop", SCANCODE_STOP},
  365. {"again", SCANCODE_AGAIN},
  366. {"undo", SCANCODE_UNDO},
  367. {"cut", SCANCODE_CUT},
  368. {"copy", SCANCODE_COPY},
  369. {"paste", SCANCODE_PASTE},
  370. {"find", SCANCODE_FIND},
  371. {"mute", SCANCODE_MUTE},
  372. {"volumeup", SCANCODE_VOLUMEUP},
  373. {"volumedown", SCANCODE_VOLUMEDOWN},
  374. {"kp,", SCANCODE_KP_COMMA},
  375. {"kp=400", SCANCODE_KP_EQUALSAS400},
  376. {"international1", SCANCODE_INTERNATIONAL1},
  377. {"international2", SCANCODE_INTERNATIONAL2},
  378. {"international3", SCANCODE_INTERNATIONAL3},
  379. {"international4", SCANCODE_INTERNATIONAL4},
  380. {"international5", SCANCODE_INTERNATIONAL5},
  381. {"international6", SCANCODE_INTERNATIONAL6},
  382. {"international7", SCANCODE_INTERNATIONAL7},
  383. {"international8", SCANCODE_INTERNATIONAL8},
  384. {"international9", SCANCODE_INTERNATIONAL9},
  385. {"lang1", SCANCODE_LANG1},
  386. {"lang2", SCANCODE_LANG2},
  387. {"lang3", SCANCODE_LANG3},
  388. {"lang4", SCANCODE_LANG4},
  389. {"lang5", SCANCODE_LANG5},
  390. {"lang6", SCANCODE_LANG6},
  391. {"lang7", SCANCODE_LANG7},
  392. {"lang8", SCANCODE_LANG8},
  393. {"lang9", SCANCODE_LANG9},
  394. {"alterase", SCANCODE_ALTERASE},
  395. {"sysreq", SCANCODE_SYSREQ},
  396. {"cancel", SCANCODE_CANCEL},
  397. {"clear", SCANCODE_CLEAR},
  398. {"prior", SCANCODE_PRIOR},
  399. {"return2", SCANCODE_RETURN2},
  400. {"separator", SCANCODE_SEPARATOR},
  401. {"out", SCANCODE_OUT},
  402. {"oper", SCANCODE_OPER},
  403. {"clearagain", SCANCODE_CLEARAGAIN},
  404. {"crsel", SCANCODE_CRSEL},
  405. {"exsel", SCANCODE_EXSEL},
  406. {"kp00", SCANCODE_KP_00},
  407. {"kp000", SCANCODE_KP_000},
  408. {"thousandsseparator", SCANCODE_THOUSANDSSEPARATOR},
  409. {"decimalseparator", SCANCODE_DECIMALSEPARATOR},
  410. {"currencyunit", SCANCODE_CURRENCYUNIT},
  411. {"currencysubunit", SCANCODE_CURRENCYSUBUNIT},
  412. {"kp(", SCANCODE_KP_LEFTPAREN},
  413. {"kp)", SCANCODE_KP_RIGHTPAREN},
  414. {"kp{", SCANCODE_KP_LEFTBRACE},
  415. {"kp}", SCANCODE_KP_RIGHTBRACE},
  416. {"kptab", SCANCODE_KP_TAB},
  417. {"kpbackspace", SCANCODE_KP_BACKSPACE},
  418. {"kpa", SCANCODE_KP_A},
  419. {"kpb", SCANCODE_KP_B},
  420. {"kpc", SCANCODE_KP_C},
  421. {"kpd", SCANCODE_KP_D},
  422. {"kpe", SCANCODE_KP_E},
  423. {"kpf", SCANCODE_KP_F},
  424. {"kpxor", SCANCODE_KP_XOR},
  425. {"kpower", SCANCODE_KP_POWER},
  426. {"kp%", SCANCODE_KP_PERCENT},
  427. {"kp<", SCANCODE_KP_LESS},
  428. {"kp>", SCANCODE_KP_GREATER},
  429. {"kp&", SCANCODE_KP_AMPERSAND},
  430. {"kp&&", SCANCODE_KP_DBLAMPERSAND},
  431. {"kp|", SCANCODE_KP_VERTICALBAR},
  432. {"kp||", SCANCODE_KP_DBLVERTICALBAR},
  433. {"kp:", SCANCODE_KP_COLON},
  434. {"kp#", SCANCODE_KP_HASH},
  435. {"kp ", SCANCODE_KP_SPACE},
  436. {"kp@", SCANCODE_KP_AT},
  437. {"kp!", SCANCODE_KP_EXCLAM},
  438. {"kpmemstore", SCANCODE_KP_MEMSTORE},
  439. {"kpmemrecall", SCANCODE_KP_MEMRECALL},
  440. {"kpmemclear", SCANCODE_KP_MEMCLEAR},
  441. {"kpmem+", SCANCODE_KP_MEMADD},
  442. {"kpmem-", SCANCODE_KP_MEMSUBTRACT},
  443. {"kpmem*", SCANCODE_KP_MEMMULTIPLY},
  444. {"kpmem/", SCANCODE_KP_MEMDIVIDE},
  445. {"kp+-", SCANCODE_KP_PLUSMINUS},
  446. {"kpclear", SCANCODE_KP_CLEAR},
  447. {"kpclearentry", SCANCODE_KP_CLEARENTRY},
  448. {"kpbinary", SCANCODE_KP_BINARY},
  449. {"kpoctal", SCANCODE_KP_OCTAL},
  450. {"kpdecimal", SCANCODE_KP_DECIMAL},
  451. {"kphex", SCANCODE_KP_HEXADECIMAL},
  452. {"lctrl", SCANCODE_LCTRL},
  453. {"lshift", SCANCODE_LSHIFT},
  454. {"lalt", SCANCODE_LALT},
  455. {"lgui", SCANCODE_LGUI},
  456. {"rctrl", SCANCODE_RCTRL},
  457. {"rshift", SCANCODE_RSHIFT},
  458. {"ralt", SCANCODE_RALT},
  459. {"rgui", SCANCODE_RGUI},
  460. {"mode", SCANCODE_MODE},
  461. {"audionext", SCANCODE_AUDIONEXT},
  462. {"audioprev", SCANCODE_AUDIOPREV},
  463. {"audiostop", SCANCODE_AUDIOSTOP},
  464. {"audioplay", SCANCODE_AUDIOPLAY},
  465. {"audiomute", SCANCODE_AUDIOMUTE},
  466. {"mediaselect", SCANCODE_MEDIASELECT},
  467. {"www", SCANCODE_WWW},
  468. {"mail", SCANCODE_MAIL},
  469. {"calculator", SCANCODE_CALCULATOR},
  470. {"computer", SCANCODE_COMPUTER},
  471. {"acsearch", SCANCODE_AC_SEARCH},
  472. {"achome", SCANCODE_AC_HOME},
  473. {"acback", SCANCODE_AC_BACK},
  474. {"acforward", SCANCODE_AC_FORWARD},
  475. {"acstop", SCANCODE_AC_STOP},
  476. {"acrefresh", SCANCODE_AC_REFRESH},
  477. {"acbookmarks", SCANCODE_AC_BOOKMARKS},
  478. {"brightnessdown", SCANCODE_BRIGHTNESSDOWN},
  479. {"brightnessup", SCANCODE_BRIGHTNESSUP},
  480. {"displayswitch", SCANCODE_DISPLAYSWITCH},
  481. {"kbdillumtoggle", SCANCODE_KBDILLUMTOGGLE},
  482. {"kbdillumdown", SCANCODE_KBDILLUMDOWN},
  483. {"kbdillumup", SCANCODE_KBDILLUMUP},
  484. {"eject", SCANCODE_EJECT},
  485. {"sleep", SCANCODE_SLEEP},
  486. {"app1", SCANCODE_APP1},
  487. {"app2", SCANCODE_APP2},
  488. };
  489. StringMap<Keyboard::Scancode, Keyboard::SCANCODE_MAX_ENUM> Keyboard::scancodes(Keyboard::scancodeEntries, sizeof(Keyboard::scancodeEntries));
  490. StringMap<Keyboard::ModifierKey, Keyboard::MODKEY_MAX_ENUM>::Entry Keyboard::modifierEntries[] =
  491. {
  492. {"numlock", MODKEY_NUMLOCK},
  493. {"capslock", MODKEY_CAPSLOCK},
  494. {"scrolllock", MODKEY_SCROLLLOCK},
  495. {"mode", MODKEY_MODE},
  496. };
  497. StringMap<Keyboard::ModifierKey, Keyboard::MODKEY_MAX_ENUM> Keyboard::modifiers(Keyboard::modifierEntries, sizeof(Keyboard::modifierEntries));
  498. } // keyboard
  499. } // love