3 #include "forwarddecl/Kb.hpp"
5 namespace rolmodl::kb {
15 static bool down(
const Scancode s);
16 static bool up(
const Scancode s);
18 static bool down(
const Key k);
19 static bool up(
const Key k);
21 static State& instance() noexcept;
23 static const uint8_t* unsafeRaw() noexcept;
24 static unsigned int unsafeRawL() noexcept;
39 Name& operator=(
const Name& that) =
delete;
40 Name& operator=(
Name&& that) =
delete;
42 static void query(
const Key k) noexcept;
43 static const char* lastQueryRes() noexcept;
45 static Name& instance() noexcept;
53 constexpr Scancode scancode(
const Key k) noexcept {
54 return scancode::unsafe::fromSDLEnum(SDL_GetScancodeFromKey(key::unsafe::toSDLEnum(k)));
56 constexpr Key fromScancode(
const Scancode s) noexcept {
57 return key::unsafe::fromSDLEnum(SDL_GetKeyFromScancode(scancode::unsafe::toSDLEnum(s)));
61 constexpr Key key(
const Scancode s) noexcept {
62 return key::fromScancode(s);
64 constexpr Scancode fromKey(
const Key k) noexcept {
65 return key::scancode(k);
133 q, w, e, r, t, y, u, i, o, p,
149 a, s, d, f, g, h, j, k, l,
324 namespace key::unsafe {
325 constexpr Key fromSDLEnum(
const SDL_Keycode k) noexcept;
326 constexpr SDL_Keycode toSDLEnum(
const Key k) noexcept;
329 enum class Scancode {
393 q, w, e, r, t, y, u, i, o, p,
409 a, s, d, f, g, h, j, k, l,
607 namespace scancode::unsafe {
608 constexpr Scancode fromSDLEnum(
const SDL_Scancode k) noexcept;
609 constexpr SDL_Scancode toSDLEnum(
const Scancode k) noexcept;
612 namespace key::unsafe {
613 constexpr Key fromSDLEnum(
const SDL_Keycode k) noexcept {
614 if (k == SDLK_UNKNOWN)
617 if (k == SDLK_RETURN)
619 if (k == SDLK_ESCAPE)
621 if (k == SDLK_BACKSPACE)
622 return Key::backspace;
627 if (k == SDLK_EXCLAIM)
628 return Key::exclamationPoint;
629 if (k == SDLK_QUOTEDBL)
633 if (k == SDLK_PERCENT)
635 if (k == SDLK_DOLLAR)
637 if (k == SDLK_AMPERSAND)
638 return Key::ampersand;
640 return Key::apostrophe;
641 if (k == SDLK_LEFTPAREN)
642 return Key::leftParen;
643 if (k == SDLK_RIGHTPAREN)
644 return Key::rightParen;
645 if (k == SDLK_ASTERISK)
646 return Key::asterisk;
653 if (k == SDLK_PERIOD)
679 if (k == SDLK_SEMICOLON)
680 return Key::semicolon;
683 if (k == SDLK_EQUALS)
685 if (k == SDLK_GREATER)
687 if (k == SDLK_QUESTION)
688 return Key::questionMark;
692 if (k == SDLK_LEFTBRACKET)
693 return Key::leftBracket;
694 if (k == SDLK_BACKSLASH)
695 return Key::backslash;
696 if (k == SDLK_RIGHTBRACKET)
697 return Key::rightBracket;
700 if (k == SDLK_UNDERSCORE)
701 return Key::underscore;
702 if (k == SDLK_BACKQUOTE)
703 return Key::backquote;
757 if (k == SDLK_CAPSLOCK)
758 return Key::capslock;
785 if (k == SDLK_PRINTSCREEN)
786 return Key::printscreen;
787 if (k == SDLK_SCROLLLOCK)
788 return Key::scrolllock;
791 if (k == SDLK_INSERT)
795 if (k == SDLK_PAGEUP)
797 if (k == SDLK_DELETE)
801 if (k == SDLK_PAGEDOWN)
802 return Key::pagedown;
812 if (k == SDLK_NUMLOCKCLEAR)
814 if (k == SDLK_KP_DIVIDE)
815 return Key::kp_divide;
816 if (k == SDLK_KP_MULTIPLY)
817 return Key::kp_multiply;
818 if (k == SDLK_KP_MINUS)
819 return Key::kp_minus;
820 if (k == SDLK_KP_PLUS)
822 if (k == SDLK_KP_ENTER)
823 return Key::kp_enter;
844 if (k == SDLK_KP_PERIOD)
845 return Key::kp_period;
847 if (k == SDLK_APPLICATION)
851 if (k == SDLK_KP_EQUALS)
877 if (k == SDLK_EXECUTE)
883 if (k == SDLK_SELECT)
901 if (k == SDLK_VOLUMEUP)
902 return Key::volumeUp;
903 if (k == SDLK_VOLUMEDOWN)
904 return Key::volumeDown;
905 if (k == SDLK_KP_COMMA)
906 return Key::kp_comma;
907 if (k == SDLK_KP_EQUALSAS400)
908 return Key::kp_eqas400;
910 if (k == SDLK_ALTERASE)
911 return Key::altErase;
912 if (k == SDLK_SYSREQ)
914 if (k == SDLK_CANCEL)
920 if (k == SDLK_RETURN2)
922 if (k == SDLK_SEPARATOR)
923 return Key::separator;
928 if (k == SDLK_CLEARAGAIN)
929 return Key::clearAgain;
937 if (k == SDLK_KP_000)
939 if (k == SDLK_THOUSANDSSEPARATOR)
940 return Key::thousandsSeparator;
941 if (k == SDLK_DECIMALSEPARATOR)
942 return Key::decimalSeparator;
943 if (k == SDLK_CURRENCYUNIT)
944 return Key::currency_unit;
945 if (k == SDLK_CURRENCYSUBUNIT)
946 return Key::currency_subunit;
947 if (k == SDLK_KP_LEFTPAREN)
948 return Key::kp_leftParen;
949 if (k == SDLK_KP_RIGHTPAREN)
950 return Key::kp_rightParen;
951 if (k == SDLK_KP_LEFTBRACE)
952 return Key::kp_leftBrace;
953 if (k == SDLK_KP_RIGHTBRACE)
954 return Key::kp_rightBrace;
955 if (k == SDLK_KP_TAB)
957 if (k == SDLK_KP_BACKSPACE)
958 return Key::kp_backspace;
971 if (k == SDLK_KP_XOR)
973 if (k == SDLK_KP_POWER)
974 return Key::kp_power;
975 if (k == SDLK_KP_PERCENT)
976 return Key::kp_percent;
977 if (k == SDLK_KP_LESS)
979 if (k == SDLK_KP_GREATER)
980 return Key::kp_greater;
981 if (k == SDLK_KP_AMPERSAND)
982 return Key::kp_ampersand;
983 if (k == SDLK_KP_DBLAMPERSAND)
984 return Key::kp_doubleAmpersand;
985 if (k == SDLK_KP_VERTICALBAR)
987 if (k == SDLK_KP_DBLVERTICALBAR)
988 return Key::kp_doubleVbar;
989 if (k == SDLK_KP_COLON)
990 return Key::kp_colon;
991 if (k == SDLK_KP_HASH)
993 if (k == SDLK_KP_SPACE)
994 return Key::kp_space;
997 if (k == SDLK_KP_EXCLAM)
998 return Key::kp_exclamationPoint;
999 if (k == SDLK_KP_MEMSTORE)
1000 return Key::kp_mem_store;
1001 if (k == SDLK_KP_MEMRECALL)
1002 return Key::kp_mem_recall;
1003 if (k == SDLK_KP_MEMCLEAR)
1004 return Key::kp_mem_clear;
1005 if (k == SDLK_KP_MEMADD)
1006 return Key::kp_mem_add;
1007 if (k == SDLK_KP_MEMSUBTRACT)
1008 return Key::kp_mem_subtract;
1009 if (k == SDLK_KP_MEMMULTIPLY)
1010 return Key::kp_mem_multiply;
1011 if (k == SDLK_KP_MEMDIVIDE)
1012 return Key::kp_mem_divide;
1013 if (k == SDLK_KP_PLUSMINUS)
1014 return Key::kp_plusMinus;
1015 if (k == SDLK_KP_CLEAR)
1016 return Key::kp_clear;
1017 if (k == SDLK_KP_CLEARENTRY)
1018 return Key::kp_clearEntry;
1019 if (k == SDLK_KP_BINARY)
1021 if (k == SDLK_KP_OCTAL)
1022 return Key::kp_octal;
1023 if (k == SDLK_KP_DECIMAL)
1024 return Key::kp_decimal;
1025 if (k == SDLK_KP_HEXADECIMAL)
1028 if (k == SDLK_LCTRL)
1030 if (k == SDLK_LSHIFT)
1036 if (k == SDLK_RCTRL)
1038 if (k == SDLK_RSHIFT)
1048 if (k == SDLK_AUDIONEXT)
1049 return Key::audio_next;
1050 if (k == SDLK_AUDIOPREV)
1051 return Key::audio_prev;
1052 if (k == SDLK_AUDIOSTOP)
1053 return Key::audio_stop;
1054 if (k == SDLK_AUDIOPLAY)
1055 return Key::audio_play;
1056 if (k == SDLK_AUDIOMUTE)
1057 return Key::audio_mute;
1058 if (k == SDLK_MEDIASELECT)
1059 return Key::mediaSelect;
1064 if (k == SDLK_CALCULATOR)
1065 return Key::calculator;
1066 if (k == SDLK_COMPUTER)
1067 return Key::computer;
1068 if (k == SDLK_AC_SEARCH)
1069 return Key::ac_search;
1070 if (k == SDLK_AC_HOME)
1071 return Key::ac_home;
1072 if (k == SDLK_AC_BACK)
1073 return Key::ac_back;
1074 if (k == SDLK_AC_FORWARD)
1076 if (k == SDLK_AC_STOP)
1077 return Key::ac_stop;
1078 if (k == SDLK_AC_REFRESH)
1079 return Key::ac_refresh;
1080 if (k == SDLK_AC_BOOKMARKS)
1081 return Key::ac_bookmarks;
1083 if (k == SDLK_BRIGHTNESSDOWN)
1084 return Key::brightnessDown;
1085 if (k == SDLK_BRIGHTNESSUP)
1086 return Key::brightnessUp;
1087 if (k == SDLK_DISPLAYSWITCH)
1088 return Key::displaySwitch;
1089 if (k == SDLK_KBDILLUMTOGGLE)
1090 return Key::kb_illum_toggle;
1091 if (k == SDLK_KBDILLUMDOWN)
1092 return Key::kb_illum_down;
1093 if (k == SDLK_KBDILLUMUP)
1094 return Key::kb_illum_up;
1095 if (k == SDLK_EJECT)
1097 if (k == SDLK_SLEEP)
1104 if (k == SDLK_AUDIOREWIND)
1105 return Key::audio_rewind;
1106 if (k == SDLK_AUDIOFASTFORWARD)
1107 return Key::audio_fastforward;
1109 return Key::unknown;
1112 constexpr SDL_Keycode toSDLEnum(
const Key k) noexcept {
1113 if (k == Key::unknown)
1114 return SDLK_UNKNOWN;
1116 if (k == Key::enter)
1118 if (k == Key::escape)
1120 if (k == Key::backspace)
1121 return SDLK_BACKSPACE;
1124 if (k == Key::space)
1126 if (k == Key::exclamationPoint)
1127 return SDLK_EXCLAIM;
1128 if (k == Key::quote)
1129 return SDLK_QUOTEDBL;
1132 if (k == Key::percent)
1133 return SDLK_PERCENT;
1134 if (k == Key::dollar)
1136 if (k == Key::ampersand)
1137 return SDLK_AMPERSAND;
1138 if (k == Key::apostrophe)
1140 if (k == Key::leftParen)
1141 return SDLK_LEFTPAREN;
1142 if (k == Key::rightParen)
1143 return SDLK_RIGHTPAREN;
1144 if (k == Key::asterisk)
1145 return SDLK_ASTERISK;
1148 if (k == Key::comma)
1150 if (k == Key::minus)
1152 if (k == Key::period)
1154 if (k == Key::slash)
1156 if (k == Key::num_0)
1158 if (k == Key::num_1)
1160 if (k == Key::num_2)
1162 if (k == Key::num_3)
1164 if (k == Key::num_4)
1166 if (k == Key::num_5)
1168 if (k == Key::num_6)
1170 if (k == Key::num_7)
1172 if (k == Key::num_8)
1174 if (k == Key::num_9)
1176 if (k == Key::colon)
1178 if (k == Key::semicolon)
1179 return SDLK_SEMICOLON;
1184 if (k == Key::greater)
1185 return SDLK_GREATER;
1186 if (k == Key::questionMark)
1187 return SDLK_QUESTION;
1191 if (k == Key::leftBracket)
1192 return SDLK_LEFTBRACKET;
1193 if (k == Key::backslash)
1194 return SDLK_BACKSLASH;
1195 if (k == Key::rightBracket)
1196 return SDLK_RIGHTBRACKET;
1197 if (k == Key::caret)
1199 if (k == Key::underscore)
1200 return SDLK_UNDERSCORE;
1201 if (k == Key::backquote)
1202 return SDLK_BACKQUOTE;
1256 if (k == Key::capslock)
1257 return SDLK_CAPSLOCK;
1284 if (k == Key::printscreen)
1285 return SDLK_PRINTSCREEN;
1286 if (k == Key::scrolllock)
1287 return SDLK_SCROLLLOCK;
1288 if (k == Key::pause)
1290 if (k == Key::insert)
1294 if (k == Key::pageup)
1300 if (k == Key::pagedown)
1301 return SDLK_PAGEDOWN;
1302 if (k == Key::right)
1311 if (k == Key::numlock)
1312 return SDLK_NUMLOCKCLEAR;
1313 if (k == Key::kp_divide)
1314 return SDLK_KP_DIVIDE;
1315 if (k == Key::kp_multiply)
1316 return SDLK_KP_MULTIPLY;
1317 if (k == Key::kp_minus)
1318 return SDLK_KP_MINUS;
1319 if (k == Key::kp_plus)
1320 return SDLK_KP_PLUS;
1321 if (k == Key::kp_enter)
1322 return SDLK_KP_ENTER;
1343 if (k == Key::kp_period)
1344 return SDLK_KP_PERIOD;
1347 return SDLK_APPLICATION;
1348 if (k == Key::power)
1350 if (k == Key::kp_eq)
1351 return SDLK_KP_EQUALS;
1377 return SDLK_EXECUTE;
1382 if (k == Key::select)
1394 if (k == Key::paste)
1400 if (k == Key::volumeUp)
1401 return SDLK_VOLUMEUP;
1402 if (k == Key::volumeDown)
1403 return SDLK_VOLUMEDOWN;
1404 if (k == Key::kp_comma)
1405 return SDLK_KP_COMMA;
1406 if (k == Key::kp_eqas400)
1407 return SDLK_KP_EQUALSAS400;
1409 if (k == Key::altErase)
1410 return SDLK_ALTERASE;
1411 if (k == Key::sysrq)
1413 if (k == Key::cancel)
1415 if (k == Key::clear)
1417 if (k == Key::prior)
1419 if (k == Key::enter2)
1420 return SDLK_RETURN2;
1421 if (k == Key::separator)
1422 return SDLK_SEPARATOR;
1427 if (k == Key::clearAgain)
1428 return SDLK_CLEARAGAIN;
1429 if (k == Key::crsel)
1431 if (k == Key::exsel)
1434 if (k == Key::kp_00)
1436 if (k == Key::kp_000)
1438 if (k == Key::thousandsSeparator)
1439 return SDLK_THOUSANDSSEPARATOR;
1440 if (k == Key::decimalSeparator)
1441 return SDLK_DECIMALSEPARATOR;
1442 if (k == Key::currency_unit)
1443 return SDLK_CURRENCYUNIT;
1444 if (k == Key::currency_subunit)
1445 return SDLK_CURRENCYSUBUNIT;
1446 if (k == Key::kp_leftParen)
1447 return SDLK_KP_LEFTPAREN;
1448 if (k == Key::kp_rightParen)
1449 return SDLK_KP_RIGHTPAREN;
1450 if (k == Key::kp_leftBrace)
1451 return SDLK_KP_LEFTBRACE;
1452 if (k == Key::kp_rightBrace)
1453 return SDLK_KP_RIGHTBRACE;
1454 if (k == Key::kp_tab)
1456 if (k == Key::kp_backspace)
1457 return SDLK_KP_BACKSPACE;
1470 if (k == Key::kp_xor)
1472 if (k == Key::kp_power)
1473 return SDLK_KP_POWER;
1474 if (k == Key::kp_percent)
1475 return SDLK_KP_PERCENT;
1476 if (k == Key::kp_less)
1477 return SDLK_KP_LESS;
1478 if (k == Key::kp_greater)
1479 return SDLK_KP_GREATER;
1480 if (k == Key::kp_ampersand)
1481 return SDLK_KP_AMPERSAND;
1482 if (k == Key::kp_doubleAmpersand)
1483 return SDLK_KP_DBLAMPERSAND;
1484 if (k == Key::kp_vbar)
1485 return SDLK_KP_VERTICALBAR;
1486 if (k == Key::kp_doubleVbar)
1487 return SDLK_KP_DBLVERTICALBAR;
1488 if (k == Key::kp_colon)
1489 return SDLK_KP_COLON;
1490 if (k == Key::kp_hash)
1491 return SDLK_KP_HASH;
1492 if (k == Key::kp_space)
1493 return SDLK_KP_SPACE;
1494 if (k == Key::kp_at)
1496 if (k == Key::kp_exclamationPoint)
1497 return SDLK_KP_EXCLAM;
1498 if (k == Key::kp_mem_store)
1499 return SDLK_KP_MEMSTORE;
1500 if (k == Key::kp_mem_recall)
1501 return SDLK_KP_MEMRECALL;
1502 if (k == Key::kp_mem_clear)
1503 return SDLK_KP_MEMCLEAR;
1504 if (k == Key::kp_mem_add)
1505 return SDLK_KP_MEMADD;
1506 if (k == Key::kp_mem_subtract)
1507 return SDLK_KP_MEMSUBTRACT;
1508 if (k == Key::kp_mem_multiply)
1509 return SDLK_KP_MEMMULTIPLY;
1510 if (k == Key::kp_mem_divide)
1511 return SDLK_KP_MEMDIVIDE;
1512 if (k == Key::kp_plusMinus)
1513 return SDLK_KP_PLUSMINUS;
1514 if (k == Key::kp_clear)
1515 return SDLK_KP_CLEAR;
1516 if (k == Key::kp_clearEntry)
1517 return SDLK_KP_CLEARENTRY;
1518 if (k == Key::kp_bin)
1519 return SDLK_KP_BINARY;
1520 if (k == Key::kp_octal)
1521 return SDLK_KP_OCTAL;
1522 if (k == Key::kp_decimal)
1523 return SDLK_KP_DECIMAL;
1524 if (k == Key::kp_hex)
1525 return SDLK_KP_HEXADECIMAL;
1527 if (k == Key::lctrl)
1529 if (k == Key::lshift)
1535 if (k == Key::rctrl)
1537 if (k == Key::rshift)
1547 if (k == Key::audio_next)
1548 return SDLK_AUDIONEXT;
1549 if (k == Key::audio_prev)
1550 return SDLK_AUDIOPREV;
1551 if (k == Key::audio_stop)
1552 return SDLK_AUDIOSTOP;
1553 if (k == Key::audio_play)
1554 return SDLK_AUDIOPLAY;
1555 if (k == Key::audio_mute)
1556 return SDLK_AUDIOMUTE;
1557 if (k == Key::mediaSelect)
1558 return SDLK_MEDIASELECT;
1563 if (k == Key::calculator)
1564 return SDLK_CALCULATOR;
1565 if (k == Key::computer)
1566 return SDLK_COMPUTER;
1567 if (k == Key::ac_search)
1568 return SDLK_AC_SEARCH;
1569 if (k == Key::ac_home)
1570 return SDLK_AC_HOME;
1571 if (k == Key::ac_back)
1572 return SDLK_AC_BACK;
1573 if (k == Key::ac_fwd)
1574 return SDLK_AC_FORWARD;
1575 if (k == Key::ac_stop)
1576 return SDLK_AC_STOP;
1577 if (k == Key::ac_refresh)
1578 return SDLK_AC_REFRESH;
1579 if (k == Key::ac_bookmarks)
1580 return SDLK_AC_BOOKMARKS;
1582 if (k == Key::brightnessDown)
1583 return SDLK_BRIGHTNESSDOWN;
1584 if (k == Key::brightnessUp)
1585 return SDLK_BRIGHTNESSUP;
1586 if (k == Key::displaySwitch)
1587 return SDLK_DISPLAYSWITCH;
1588 if (k == Key::kb_illum_toggle)
1589 return SDLK_KBDILLUMTOGGLE;
1590 if (k == Key::kb_illum_down)
1591 return SDLK_KBDILLUMDOWN;
1592 if (k == Key::kb_illum_up)
1593 return SDLK_KBDILLUMUP;
1594 if (k == Key::eject)
1596 if (k == Key::sleep)
1603 if (k == Key::audio_rewind)
1604 return SDLK_AUDIOREWIND;
1605 if (k == Key::audio_fastforward)
1606 return SDLK_AUDIOFASTFORWARD;
1608 return SDLK_UNKNOWN;
1612 namespace scancode::unsafe {
1613 constexpr Scancode fromSDLEnum(
const SDL_Scancode k) noexcept {
1614 if (k == SDL_SCANCODE_UNKNOWN)
1615 return Scancode::unknown;
1617 if (k == SDL_SCANCODE_A)
1619 if (k == SDL_SCANCODE_B)
1621 if (k == SDL_SCANCODE_C)
1623 if (k == SDL_SCANCODE_D)
1625 if (k == SDL_SCANCODE_E)
1627 if (k == SDL_SCANCODE_F)
1629 if (k == SDL_SCANCODE_G)
1631 if (k == SDL_SCANCODE_H)
1633 if (k == SDL_SCANCODE_I)
1635 if (k == SDL_SCANCODE_J)
1637 if (k == SDL_SCANCODE_K)
1639 if (k == SDL_SCANCODE_L)
1641 if (k == SDL_SCANCODE_M)
1643 if (k == SDL_SCANCODE_N)
1645 if (k == SDL_SCANCODE_O)
1647 if (k == SDL_SCANCODE_P)
1649 if (k == SDL_SCANCODE_Q)
1651 if (k == SDL_SCANCODE_R)
1653 if (k == SDL_SCANCODE_S)
1655 if (k == SDL_SCANCODE_T)
1657 if (k == SDL_SCANCODE_U)
1659 if (k == SDL_SCANCODE_V)
1661 if (k == SDL_SCANCODE_W)
1663 if (k == SDL_SCANCODE_X)
1665 if (k == SDL_SCANCODE_Y)
1667 if (k == SDL_SCANCODE_Z)
1670 if (k == SDL_SCANCODE_1)
1671 return Scancode::num_1;
1672 if (k == SDL_SCANCODE_2)
1673 return Scancode::num_2;
1674 if (k == SDL_SCANCODE_3)
1675 return Scancode::num_3;
1676 if (k == SDL_SCANCODE_4)
1677 return Scancode::num_4;
1678 if (k == SDL_SCANCODE_5)
1679 return Scancode::num_5;
1680 if (k == SDL_SCANCODE_6)
1681 return Scancode::num_6;
1682 if (k == SDL_SCANCODE_7)
1683 return Scancode::num_7;
1684 if (k == SDL_SCANCODE_8)
1685 return Scancode::num_8;
1686 if (k == SDL_SCANCODE_9)
1687 return Scancode::num_9;
1688 if (k == SDL_SCANCODE_0)
1689 return Scancode::num_0;
1691 if (k == SDL_SCANCODE_RETURN)
1692 return Scancode::enter;
1693 if (k == SDL_SCANCODE_ESCAPE)
1694 return Scancode::escape;
1695 if (k == SDL_SCANCODE_BACKSPACE)
1696 return Scancode::backspace;
1697 if (k == SDL_SCANCODE_TAB)
1698 return Scancode::tab;
1699 if (k == SDL_SCANCODE_SPACE)
1700 return Scancode::space;
1702 if (k == SDL_SCANCODE_MINUS)
1703 return Scancode::minus;
1704 if (k == SDL_SCANCODE_EQUALS)
1705 return Scancode::eq;
1706 if (k == SDL_SCANCODE_LEFTBRACKET)
1707 return Scancode::leftBracket;
1708 if (k == SDL_SCANCODE_RIGHTBRACKET)
1709 return Scancode::rightBracket;
1710 if (k == SDL_SCANCODE_BACKSLASH)
1711 return Scancode::backslash;
1712 if (k == SDL_SCANCODE_NONUSHASH)
1713 return Scancode::nonUsHash;
1714 if (k == SDL_SCANCODE_SEMICOLON)
1715 return Scancode::semicolon;
1716 if (k == SDL_SCANCODE_APOSTROPHE)
1717 return Scancode::apostrophe;
1718 if (k == SDL_SCANCODE_GRAVE)
1719 return Scancode::backquote;
1720 if (k == SDL_SCANCODE_COMMA)
1721 return Scancode::comma;
1722 if (k == SDL_SCANCODE_PERIOD)
1723 return Scancode::period;
1724 if (k == SDL_SCANCODE_SLASH)
1725 return Scancode::slash;
1727 if (k == SDL_SCANCODE_CAPSLOCK)
1728 return Scancode::capslock;
1730 if (k == SDL_SCANCODE_F1)
1731 return Scancode::f1;
1732 if (k == SDL_SCANCODE_F2)
1733 return Scancode::f2;
1734 if (k == SDL_SCANCODE_F3)
1735 return Scancode::f3;
1736 if (k == SDL_SCANCODE_F4)
1737 return Scancode::f4;
1738 if (k == SDL_SCANCODE_F5)
1739 return Scancode::f5;
1740 if (k == SDL_SCANCODE_F6)
1741 return Scancode::f6;
1742 if (k == SDL_SCANCODE_F7)
1743 return Scancode::f7;
1744 if (k == SDL_SCANCODE_F8)
1745 return Scancode::f8;
1746 if (k == SDL_SCANCODE_F9)
1747 return Scancode::f9;
1748 if (k == SDL_SCANCODE_F10)
1749 return Scancode::f10;
1750 if (k == SDL_SCANCODE_F11)
1751 return Scancode::f11;
1752 if (k == SDL_SCANCODE_F12)
1753 return Scancode::f12;
1755 if (k == SDL_SCANCODE_PRINTSCREEN)
1756 return Scancode::printscreen;
1757 if (k == SDL_SCANCODE_SCROLLLOCK)
1758 return Scancode::scrolllock;
1759 if (k == SDL_SCANCODE_PAUSE)
1760 return Scancode::pause;
1761 if (k == SDL_SCANCODE_INSERT)
1762 return Scancode::insert;
1763 if (k == SDL_SCANCODE_HOME)
1764 return Scancode::home;
1765 if (k == SDL_SCANCODE_PAGEUP)
1766 return Scancode::pageup;
1767 if (k == SDL_SCANCODE_DELETE)
1768 return Scancode::del;
1769 if (k == SDL_SCANCODE_END)
1770 return Scancode::end;
1771 if (k == SDL_SCANCODE_PAGEDOWN)
1772 return Scancode::pagedown;
1773 if (k == SDL_SCANCODE_RIGHT)
1774 return Scancode::right;
1775 if (k == SDL_SCANCODE_LEFT)
1776 return Scancode::left;
1777 if (k == SDL_SCANCODE_DOWN)
1778 return Scancode::down;
1779 if (k == SDL_SCANCODE_UP)
1780 return Scancode::up;
1782 if (k == SDL_SCANCODE_NUMLOCKCLEAR)
1783 return Scancode::numlock;
1784 if (k == SDL_SCANCODE_KP_DIVIDE)
1785 return Scancode::kp_divide;
1786 if (k == SDL_SCANCODE_KP_MULTIPLY)
1787 return Scancode::kp_multiply;
1788 if (k == SDL_SCANCODE_KP_MINUS)
1789 return Scancode::kp_minus;
1790 if (k == SDL_SCANCODE_KP_PLUS)
1791 return Scancode::kp_plus;
1792 if (k == SDL_SCANCODE_KP_ENTER)
1793 return Scancode::kp_enter;
1794 if (k == SDL_SCANCODE_KP_1)
1795 return Scancode::kp_1;
1796 if (k == SDL_SCANCODE_KP_2)
1797 return Scancode::kp_2;
1798 if (k == SDL_SCANCODE_KP_3)
1799 return Scancode::kp_3;
1800 if (k == SDL_SCANCODE_KP_4)
1801 return Scancode::kp_4;
1802 if (k == SDL_SCANCODE_KP_5)
1803 return Scancode::kp_5;
1804 if (k == SDL_SCANCODE_KP_6)
1805 return Scancode::kp_6;
1806 if (k == SDL_SCANCODE_KP_7)
1807 return Scancode::kp_7;
1808 if (k == SDL_SCANCODE_KP_8)
1809 return Scancode::kp_8;
1810 if (k == SDL_SCANCODE_KP_9)
1811 return Scancode::kp_9;
1812 if (k == SDL_SCANCODE_KP_0)
1813 return Scancode::kp_0;
1814 if (k == SDL_SCANCODE_KP_PERIOD)
1815 return Scancode::kp_period;
1817 if (k == SDL_SCANCODE_NONUSBACKSLASH)
1818 return Scancode::nonUsBackslash;
1819 if (k == SDL_SCANCODE_APPLICATION)
1820 return Scancode::app;
1821 if (k == SDL_SCANCODE_POWER)
1822 return Scancode::power;
1823 if (k == SDL_SCANCODE_KP_EQUALS)
1824 return Scancode::kp_eq;
1825 if (k == SDL_SCANCODE_F13)
1826 return Scancode::f13;
1827 if (k == SDL_SCANCODE_F14)
1828 return Scancode::f14;
1829 if (k == SDL_SCANCODE_F15)
1830 return Scancode::f15;
1831 if (k == SDL_SCANCODE_F16)
1832 return Scancode::f16;
1833 if (k == SDL_SCANCODE_F17)
1834 return Scancode::f17;
1835 if (k == SDL_SCANCODE_F18)
1836 return Scancode::f18;
1837 if (k == SDL_SCANCODE_F19)
1838 return Scancode::f19;
1839 if (k == SDL_SCANCODE_F20)
1840 return Scancode::f20;
1841 if (k == SDL_SCANCODE_F21)
1842 return Scancode::f21;
1843 if (k == SDL_SCANCODE_F22)
1844 return Scancode::f22;
1845 if (k == SDL_SCANCODE_F23)
1846 return Scancode::f23;
1847 if (k == SDL_SCANCODE_F24)
1848 return Scancode::f24;
1849 if (k == SDL_SCANCODE_EXECUTE)
1850 return Scancode::exec;
1851 if (k == SDL_SCANCODE_HELP)
1852 return Scancode::help;
1853 if (k == SDL_SCANCODE_MENU)
1854 return Scancode::menu;
1855 if (k == SDL_SCANCODE_SELECT)
1856 return Scancode::select;
1857 if (k == SDL_SCANCODE_STOP)
1858 return Scancode::stop;
1859 if (k == SDL_SCANCODE_AGAIN)
1860 return Scancode::redo;
1861 if (k == SDL_SCANCODE_UNDO)
1862 return Scancode::undo;
1863 if (k == SDL_SCANCODE_CUT)
1864 return Scancode::cut;
1865 if (k == SDL_SCANCODE_COPY)
1866 return Scancode::copy;
1867 if (k == SDL_SCANCODE_PASTE)
1868 return Scancode::paste;
1869 if (k == SDL_SCANCODE_FIND)
1870 return Scancode::find;
1871 if (k == SDL_SCANCODE_MUTE)
1872 return Scancode::mute;
1873 if (k == SDL_SCANCODE_VOLUMEUP)
1874 return Scancode::volumeUp;
1875 if (k == SDL_SCANCODE_VOLUMEDOWN)
1876 return Scancode::volumeDown;
1877 if (k == SDL_SCANCODE_KP_COMMA)
1878 return Scancode::kp_comma;
1879 if (k == SDL_SCANCODE_KP_EQUALSAS400)
1880 return Scancode::kp_eqas400;
1882 if (k == SDL_SCANCODE_INTERNATIONAL1)
1883 return Scancode::internat_1;
1884 if (k == SDL_SCANCODE_INTERNATIONAL2)
1885 return Scancode::internat_2;
1886 if (k == SDL_SCANCODE_INTERNATIONAL3)
1887 return Scancode::internat_3;
1888 if (k == SDL_SCANCODE_INTERNATIONAL4)
1889 return Scancode::internat_4;
1890 if (k == SDL_SCANCODE_INTERNATIONAL5)
1891 return Scancode::internat_5;
1892 if (k == SDL_SCANCODE_INTERNATIONAL6)
1893 return Scancode::internat_6;
1894 if (k == SDL_SCANCODE_INTERNATIONAL7)
1895 return Scancode::internat_7;
1896 if (k == SDL_SCANCODE_INTERNATIONAL8)
1897 return Scancode::internat_8;
1898 if (k == SDL_SCANCODE_INTERNATIONAL9)
1899 return Scancode::internat_9;
1900 if (k == SDL_SCANCODE_LANG1)
1901 return Scancode::lang_1;
1902 if (k == SDL_SCANCODE_LANG2)
1903 return Scancode::lang_2;
1904 if (k == SDL_SCANCODE_LANG3)
1905 return Scancode::lang_3;
1906 if (k == SDL_SCANCODE_LANG4)
1907 return Scancode::lang_4;
1908 if (k == SDL_SCANCODE_LANG5)
1909 return Scancode::lang_5;
1910 if (k == SDL_SCANCODE_LANG6)
1911 return Scancode::lang_6;
1912 if (k == SDL_SCANCODE_LANG7)
1913 return Scancode::lang_7;
1914 if (k == SDL_SCANCODE_LANG8)
1915 return Scancode::lang_8;
1916 if (k == SDL_SCANCODE_LANG9)
1917 return Scancode::lang_9;
1919 if (k == SDL_SCANCODE_ALTERASE)
1920 return Scancode::altErase;
1921 if (k == SDL_SCANCODE_SYSREQ)
1922 return Scancode::sysrq;
1923 if (k == SDL_SCANCODE_CANCEL)
1924 return Scancode::cancel;
1925 if (k == SDL_SCANCODE_CLEAR)
1926 return Scancode::clear;
1927 if (k == SDL_SCANCODE_PRIOR)
1928 return Scancode::prior;
1929 if (k == SDL_SCANCODE_RETURN2)
1930 return Scancode::enter2;
1931 if (k == SDL_SCANCODE_SEPARATOR)
1932 return Scancode::separator;
1933 if (k == SDL_SCANCODE_OUT)
1934 return Scancode::out;
1935 if (k == SDL_SCANCODE_OPER)
1936 return Scancode::oper;
1937 if (k == SDL_SCANCODE_CLEARAGAIN)
1938 return Scancode::clearAgain;
1939 if (k == SDL_SCANCODE_CRSEL)
1940 return Scancode::crsel;
1941 if (k == SDL_SCANCODE_EXSEL)
1942 return Scancode::exsel;
1944 if (k == SDL_SCANCODE_KP_00)
1945 return Scancode::kp_00;
1946 if (k == SDL_SCANCODE_KP_000)
1947 return Scancode::kp_000;
1948 if (k == SDL_SCANCODE_THOUSANDSSEPARATOR)
1949 return Scancode::thousandsSeparator;
1950 if (k == SDL_SCANCODE_DECIMALSEPARATOR)
1951 return Scancode::decimalSeparator;
1952 if (k == SDL_SCANCODE_CURRENCYUNIT)
1953 return Scancode::currency_unit;
1954 if (k == SDL_SCANCODE_CURRENCYSUBUNIT)
1955 return Scancode::currency_subunit;
1956 if (k == SDL_SCANCODE_KP_LEFTPAREN)
1957 return Scancode::kp_leftParen;
1958 if (k == SDL_SCANCODE_KP_RIGHTPAREN)
1959 return Scancode::kp_rightParen;
1960 if (k == SDL_SCANCODE_KP_LEFTBRACE)
1961 return Scancode::kp_leftBrace;
1962 if (k == SDL_SCANCODE_KP_RIGHTBRACE)
1963 return Scancode::kp_rightBrace;
1964 if (k == SDL_SCANCODE_KP_TAB)
1965 return Scancode::kp_tab;
1966 if (k == SDL_SCANCODE_KP_BACKSPACE)
1967 return Scancode::kp_backspace;
1968 if (k == SDL_SCANCODE_KP_A)
1969 return Scancode::kp_a;
1970 if (k == SDL_SCANCODE_KP_B)
1971 return Scancode::kp_b;
1972 if (k == SDL_SCANCODE_KP_C)
1973 return Scancode::kp_c;
1974 if (k == SDL_SCANCODE_KP_D)
1975 return Scancode::kp_d;
1976 if (k == SDL_SCANCODE_KP_E)
1977 return Scancode::kp_e;
1978 if (k == SDL_SCANCODE_KP_F)
1979 return Scancode::kp_f;
1980 if (k == SDL_SCANCODE_KP_XOR)
1981 return Scancode::kp_xor;
1982 if (k == SDL_SCANCODE_KP_POWER)
1983 return Scancode::kp_power;
1984 if (k == SDL_SCANCODE_KP_PERCENT)
1985 return Scancode::kp_percent;
1986 if (k == SDL_SCANCODE_KP_LESS)
1987 return Scancode::kp_less;
1988 if (k == SDL_SCANCODE_KP_GREATER)
1989 return Scancode::kp_greater;
1990 if (k == SDL_SCANCODE_KP_AMPERSAND)
1991 return Scancode::kp_ampersand;
1992 if (k == SDL_SCANCODE_KP_DBLAMPERSAND)
1993 return Scancode::kp_doubleAmpersand;
1994 if (k == SDL_SCANCODE_KP_VERTICALBAR)
1995 return Scancode::kp_vbar;
1996 if (k == SDL_SCANCODE_KP_DBLVERTICALBAR)
1997 return Scancode::kp_doubleVbar;
1998 if (k == SDL_SCANCODE_KP_COLON)
1999 return Scancode::kp_colon;
2000 if (k == SDL_SCANCODE_KP_HASH)
2001 return Scancode::kp_hash;
2002 if (k == SDL_SCANCODE_KP_SPACE)
2003 return Scancode::kp_space;
2004 if (k == SDL_SCANCODE_KP_AT)
2005 return Scancode::kp_at;
2006 if (k == SDL_SCANCODE_KP_EXCLAM)
2007 return Scancode::kp_exclamationPoint;
2008 if (k == SDL_SCANCODE_KP_MEMSTORE)
2009 return Scancode::kp_mem_store;
2010 if (k == SDL_SCANCODE_KP_MEMRECALL)
2011 return Scancode::kp_mem_recall;
2012 if (k == SDL_SCANCODE_KP_MEMCLEAR)
2013 return Scancode::kp_mem_clear;
2014 if (k == SDL_SCANCODE_KP_MEMADD)
2015 return Scancode::kp_mem_add;
2016 if (k == SDL_SCANCODE_KP_MEMSUBTRACT)
2017 return Scancode::kp_mem_subtract;
2018 if (k == SDL_SCANCODE_KP_MEMMULTIPLY)
2019 return Scancode::kp_mem_multiply;
2020 if (k == SDL_SCANCODE_KP_MEMDIVIDE)
2021 return Scancode::kp_mem_divide;
2022 if (k == SDL_SCANCODE_KP_PLUSMINUS)
2023 return Scancode::kp_plusMinus;
2024 if (k == SDL_SCANCODE_KP_CLEAR)
2025 return Scancode::kp_mem_clear;
2026 if (k == SDL_SCANCODE_KP_CLEARENTRY)
2027 return Scancode::kp_clearEntry;
2028 if (k == SDL_SCANCODE_KP_BINARY)
2029 return Scancode::kp_bin;
2030 if (k == SDL_SCANCODE_KP_OCTAL)
2031 return Scancode::kp_octal;
2032 if (k == SDL_SCANCODE_KP_DECIMAL)
2033 return Scancode::kp_decimal;
2034 if (k == SDL_SCANCODE_KP_HEXADECIMAL)
2035 return Scancode::kp_hex;
2037 if (k == SDL_SCANCODE_LCTRL)
2038 return Scancode::lctrl;
2039 if (k == SDL_SCANCODE_LSHIFT)
2040 return Scancode::lshift;
2041 if (k == SDL_SCANCODE_LALT)
2042 return Scancode::lalt;
2043 if (k == SDL_SCANCODE_LGUI)
2044 return Scancode::lgui;
2045 if (k == SDL_SCANCODE_RCTRL)
2046 return Scancode::rctrl;
2047 if (k == SDL_SCANCODE_RSHIFT)
2048 return Scancode::rshift;
2049 if (k == SDL_SCANCODE_RALT)
2050 return Scancode::ralt;
2051 if (k == SDL_SCANCODE_RGUI)
2052 return Scancode::rgui;
2054 if (k == SDL_SCANCODE_MODE)
2055 return Scancode::mode;
2057 if (k == SDL_SCANCODE_AUDIONEXT)
2058 return Scancode::audio_next;
2059 if (k == SDL_SCANCODE_AUDIOPREV)
2060 return Scancode::audio_prev;
2061 if (k == SDL_SCANCODE_AUDIOSTOP)
2062 return Scancode::audio_stop;
2063 if (k == SDL_SCANCODE_AUDIOPLAY)
2064 return Scancode::audio_play;
2065 if (k == SDL_SCANCODE_AUDIOMUTE)
2066 return Scancode::audio_mute;
2067 if (k == SDL_SCANCODE_MEDIASELECT)
2068 return Scancode::mediaSelect;
2069 if (k == SDL_SCANCODE_WWW)
2070 return Scancode::www;
2071 if (k == SDL_SCANCODE_MAIL)
2072 return Scancode::mail;
2073 if (k == SDL_SCANCODE_CALCULATOR)
2074 return Scancode::calculator;
2075 if (k == SDL_SCANCODE_COMPUTER)
2076 return Scancode::computer;
2077 if (k == SDL_SCANCODE_AC_SEARCH)
2078 return Scancode::ac_search;
2079 if (k == SDL_SCANCODE_AC_HOME)
2080 return Scancode::ac_home;
2081 if (k == SDL_SCANCODE_AC_BACK)
2082 return Scancode::ac_back;
2083 if (k == SDL_SCANCODE_AC_FORWARD)
2084 return Scancode::ac_fwd;
2085 if (k == SDL_SCANCODE_AC_STOP)
2086 return Scancode::ac_stop;
2087 if (k == SDL_SCANCODE_AC_REFRESH)
2088 return Scancode::ac_refresh;
2089 if (k == SDL_SCANCODE_AC_BOOKMARKS)
2090 return Scancode::ac_bookmarks;
2092 if (k == SDL_SCANCODE_BRIGHTNESSDOWN)
2093 return Scancode::brightnessDown;
2094 if (k == SDL_SCANCODE_BRIGHTNESSUP)
2095 return Scancode::brightnessUp;
2096 if (k == SDL_SCANCODE_DISPLAYSWITCH)
2097 return Scancode::displaySwitch;
2098 if (k == SDL_SCANCODE_KBDILLUMTOGGLE)
2099 return Scancode::kb_illum_toggle;
2100 if (k == SDL_SCANCODE_KBDILLUMDOWN)
2101 return Scancode::kb_illum_down;
2102 if (k == SDL_SCANCODE_KBDILLUMUP)
2103 return Scancode::kb_illum_up;
2104 if (k == SDL_SCANCODE_EJECT)
2105 return Scancode::eject;
2106 if (k == SDL_SCANCODE_SLEEP)
2107 return Scancode::sleep;
2109 if (k == SDL_SCANCODE_APP1)
2110 return Scancode::app1;
2111 if (k == SDL_SCANCODE_APP2)
2112 return Scancode::app2;
2114 if (k == SDL_SCANCODE_AUDIOREWIND)
2115 return Scancode::audio_rewind;
2116 if (k == SDL_SCANCODE_AUDIOFASTFORWARD)
2117 return Scancode::audio_fastforward;
2119 return Scancode::unknown;
2121 constexpr SDL_Scancode toSDLEnum(
const Scancode k) noexcept {
2122 if (k == Scancode::unknown)
2123 return SDL_SCANCODE_UNKNOWN;
2125 if (k == Scancode::a)
2126 return SDL_SCANCODE_A;
2127 if (k == Scancode::b)
2128 return SDL_SCANCODE_B;
2129 if (k == Scancode::c)
2130 return SDL_SCANCODE_C;
2131 if (k == Scancode::d)
2132 return SDL_SCANCODE_D;
2133 if (k == Scancode::e)
2134 return SDL_SCANCODE_E;
2135 if (k == Scancode::f)
2136 return SDL_SCANCODE_F;
2137 if (k == Scancode::g)
2138 return SDL_SCANCODE_G;
2139 if (k == Scancode::h)
2140 return SDL_SCANCODE_H;
2141 if (k == Scancode::i)
2142 return SDL_SCANCODE_I;
2143 if (k == Scancode::j)
2144 return SDL_SCANCODE_J;
2145 if (k == Scancode::k)
2146 return SDL_SCANCODE_K;
2147 if (k == Scancode::l)
2148 return SDL_SCANCODE_L;
2149 if (k == Scancode::m)
2150 return SDL_SCANCODE_M;
2151 if (k == Scancode::n)
2152 return SDL_SCANCODE_N;
2153 if (k == Scancode::o)
2154 return SDL_SCANCODE_O;
2155 if (k == Scancode::p)
2156 return SDL_SCANCODE_P;
2157 if (k == Scancode::q)
2158 return SDL_SCANCODE_Q;
2159 if (k == Scancode::r)
2160 return SDL_SCANCODE_R;
2161 if (k == Scancode::s)
2162 return SDL_SCANCODE_S;
2163 if (k == Scancode::t)
2164 return SDL_SCANCODE_T;
2165 if (k == Scancode::u)
2166 return SDL_SCANCODE_U;
2167 if (k == Scancode::v)
2168 return SDL_SCANCODE_V;
2169 if (k == Scancode::w)
2170 return SDL_SCANCODE_W;
2171 if (k == Scancode::x)
2172 return SDL_SCANCODE_X;
2173 if (k == Scancode::y)
2174 return SDL_SCANCODE_Y;
2175 if (k == Scancode::z)
2176 return SDL_SCANCODE_Z;
2178 if (k == Scancode::num_1)
2179 return SDL_SCANCODE_1;
2180 if (k == Scancode::num_2)
2181 return SDL_SCANCODE_2;
2182 if (k == Scancode::num_3)
2183 return SDL_SCANCODE_3;
2184 if (k == Scancode::num_4)
2185 return SDL_SCANCODE_4;
2186 if (k == Scancode::num_5)
2187 return SDL_SCANCODE_5;
2188 if (k == Scancode::num_6)
2189 return SDL_SCANCODE_6;
2190 if (k == Scancode::num_7)
2191 return SDL_SCANCODE_7;
2192 if (k == Scancode::num_8)
2193 return SDL_SCANCODE_8;
2194 if (k == Scancode::num_9)
2195 return SDL_SCANCODE_9;
2196 if (k == Scancode::num_0)
2197 return SDL_SCANCODE_0;
2199 if (k == Scancode::enter)
2200 return SDL_SCANCODE_RETURN;
2201 if (k == Scancode::escape)
2202 return SDL_SCANCODE_ESCAPE;
2203 if (k == Scancode::backspace)
2204 return SDL_SCANCODE_BACKSPACE;
2205 if (k == Scancode::tab)
2206 return SDL_SCANCODE_TAB;
2207 if (k == Scancode::space)
2208 return SDL_SCANCODE_SPACE;
2210 if (k == Scancode::minus)
2211 return SDL_SCANCODE_MINUS;
2212 if (k == Scancode::eq)
2213 return SDL_SCANCODE_EQUALS;
2214 if (k == Scancode::leftBracket)
2215 return SDL_SCANCODE_LEFTBRACKET;
2216 if (k == Scancode::rightBracket)
2217 return SDL_SCANCODE_RIGHTBRACKET;
2218 if (k == Scancode::backslash)
2219 return SDL_SCANCODE_BACKSLASH;
2220 if (k == Scancode::nonUsHash)
2221 return SDL_SCANCODE_NONUSHASH;
2222 if (k == Scancode::semicolon)
2223 return SDL_SCANCODE_SEMICOLON;
2224 if (k == Scancode::apostrophe)
2225 return SDL_SCANCODE_APOSTROPHE;
2226 if (k == Scancode::backquote)
2227 return SDL_SCANCODE_GRAVE;
2228 if (k == Scancode::comma)
2229 return SDL_SCANCODE_COMMA;
2230 if (k == Scancode::period)
2231 return SDL_SCANCODE_PERIOD;
2232 if (k == Scancode::slash)
2233 return SDL_SCANCODE_SLASH;
2235 if (k == Scancode::capslock)
2236 return SDL_SCANCODE_CAPSLOCK;
2238 if (k == Scancode::f1)
2239 return SDL_SCANCODE_F1;
2240 if (k == Scancode::f2)
2241 return SDL_SCANCODE_F2;
2242 if (k == Scancode::f3)
2243 return SDL_SCANCODE_F3;
2244 if (k == Scancode::f4)
2245 return SDL_SCANCODE_F4;
2246 if (k == Scancode::f5)
2247 return SDL_SCANCODE_F5;
2248 if (k == Scancode::f6)
2249 return SDL_SCANCODE_F6;
2250 if (k == Scancode::f7)
2251 return SDL_SCANCODE_F7;
2252 if (k == Scancode::f8)
2253 return SDL_SCANCODE_F8;
2254 if (k == Scancode::f9)
2255 return SDL_SCANCODE_F9;
2256 if (k == Scancode::f10)
2257 return SDL_SCANCODE_F10;
2258 if (k == Scancode::f11)
2259 return SDL_SCANCODE_F11;
2260 if (k == Scancode::f12)
2261 return SDL_SCANCODE_F12;
2263 if (k == Scancode::printscreen)
2264 return SDL_SCANCODE_PRINTSCREEN;
2265 if (k == Scancode::scrolllock)
2266 return SDL_SCANCODE_SCROLLLOCK;
2267 if (k == Scancode::pause)
2268 return SDL_SCANCODE_PAUSE;
2269 if (k == Scancode::insert)
2270 return SDL_SCANCODE_INSERT;
2271 if (k == Scancode::home)
2272 return SDL_SCANCODE_HOME;
2273 if (k == Scancode::pageup)
2274 return SDL_SCANCODE_PAGEUP;
2275 if (k == Scancode::del)
2276 return SDL_SCANCODE_DELETE;
2277 if (k == Scancode::end)
2278 return SDL_SCANCODE_END;
2279 if (k == Scancode::pagedown)
2280 return SDL_SCANCODE_PAGEDOWN;
2281 if (k == Scancode::right)
2282 return SDL_SCANCODE_RIGHT;
2283 if (k == Scancode::left)
2284 return SDL_SCANCODE_LEFT;
2285 if (k == Scancode::down)
2286 return SDL_SCANCODE_DOWN;
2287 if (k == Scancode::up)
2288 return SDL_SCANCODE_UP;
2290 if (k == Scancode::numlock)
2291 return SDL_SCANCODE_NUMLOCKCLEAR;
2292 if (k == Scancode::kp_divide)
2293 return SDL_SCANCODE_KP_DIVIDE;
2294 if (k == Scancode::kp_multiply)
2295 return SDL_SCANCODE_KP_MULTIPLY;
2296 if (k == Scancode::kp_minus)
2297 return SDL_SCANCODE_KP_MINUS;
2298 if (k == Scancode::kp_plus)
2299 return SDL_SCANCODE_KP_PLUS;
2300 if (k == Scancode::kp_enter)
2301 return SDL_SCANCODE_KP_ENTER;
2302 if (k == Scancode::kp_1)
2303 return SDL_SCANCODE_KP_1;
2304 if (k == Scancode::kp_2)
2305 return SDL_SCANCODE_KP_2;
2306 if (k == Scancode::kp_3)
2307 return SDL_SCANCODE_KP_3;
2308 if (k == Scancode::kp_4)
2309 return SDL_SCANCODE_KP_4;
2310 if (k == Scancode::kp_5)
2311 return SDL_SCANCODE_KP_5;
2312 if (k == Scancode::kp_6)
2313 return SDL_SCANCODE_KP_6;
2314 if (k == Scancode::kp_7)
2315 return SDL_SCANCODE_KP_7;
2316 if (k == Scancode::kp_8)
2317 return SDL_SCANCODE_KP_8;
2318 if (k == Scancode::kp_9)
2319 return SDL_SCANCODE_KP_9;
2320 if (k == Scancode::kp_0)
2321 return SDL_SCANCODE_KP_0;
2322 if (k == Scancode::kp_period)
2323 return SDL_SCANCODE_KP_PERIOD;
2325 if (k == Scancode::nonUsBackslash)
2326 return SDL_SCANCODE_NONUSBACKSLASH;
2327 if (k == Scancode::app)
2328 return SDL_SCANCODE_APPLICATION;
2329 if (k == Scancode::power)
2330 return SDL_SCANCODE_POWER;
2331 if (k == Scancode::kp_eq)
2332 return SDL_SCANCODE_KP_EQUALS;
2333 if (k == Scancode::f13)
2334 return SDL_SCANCODE_F13;
2335 if (k == Scancode::f14)
2336 return SDL_SCANCODE_F14;
2337 if (k == Scancode::f15)
2338 return SDL_SCANCODE_F15;
2339 if (k == Scancode::f16)
2340 return SDL_SCANCODE_F16;
2341 if (k == Scancode::f17)
2342 return SDL_SCANCODE_F17;
2343 if (k == Scancode::f18)
2344 return SDL_SCANCODE_F18;
2345 if (k == Scancode::f19)
2346 return SDL_SCANCODE_F19;
2347 if (k == Scancode::f20)
2348 return SDL_SCANCODE_F20;
2349 if (k == Scancode::f21)
2350 return SDL_SCANCODE_F21;
2351 if (k == Scancode::f22)
2352 return SDL_SCANCODE_F22;
2353 if (k == Scancode::f23)
2354 return SDL_SCANCODE_F23;
2355 if (k == Scancode::f24)
2356 return SDL_SCANCODE_F24;
2357 if (k == Scancode::exec)
2358 return SDL_SCANCODE_EXECUTE;
2359 if (k == Scancode::help)
2360 return SDL_SCANCODE_HELP;
2361 if (k == Scancode::menu)
2362 return SDL_SCANCODE_MENU;
2363 if (k == Scancode::select)
2364 return SDL_SCANCODE_SELECT;
2365 if (k == Scancode::stop)
2366 return SDL_SCANCODE_STOP;
2367 if (k == Scancode::redo)
2368 return SDL_SCANCODE_AGAIN;
2369 if (k == Scancode::undo)
2370 return SDL_SCANCODE_UNDO;
2371 if (k == Scancode::cut)
2372 return SDL_SCANCODE_CUT;
2373 if (k == Scancode::copy)
2374 return SDL_SCANCODE_COPY;
2375 if (k == Scancode::paste)
2376 return SDL_SCANCODE_PASTE;
2377 if (k == Scancode::find)
2378 return SDL_SCANCODE_FIND;
2379 if (k == Scancode::mute)
2380 return SDL_SCANCODE_MUTE;
2381 if (k == Scancode::volumeUp)
2382 return SDL_SCANCODE_VOLUMEUP;
2383 if (k == Scancode::volumeDown)
2384 return SDL_SCANCODE_VOLUMEDOWN;
2385 if (k == Scancode::kp_comma)
2386 return SDL_SCANCODE_KP_COMMA;
2387 if (k == Scancode::kp_eqas400)
2388 return SDL_SCANCODE_KP_EQUALSAS400;
2390 if (k == Scancode::internat_1)
2391 return SDL_SCANCODE_INTERNATIONAL1;
2392 if (k == Scancode::internat_2)
2393 return SDL_SCANCODE_INTERNATIONAL2;
2394 if (k == Scancode::internat_3)
2395 return SDL_SCANCODE_INTERNATIONAL3;
2396 if (k == Scancode::internat_4)
2397 return SDL_SCANCODE_INTERNATIONAL4;
2398 if (k == Scancode::internat_5)
2399 return SDL_SCANCODE_INTERNATIONAL5;
2400 if (k == Scancode::internat_6)
2401 return SDL_SCANCODE_INTERNATIONAL6;
2402 if (k == Scancode::internat_7)
2403 return SDL_SCANCODE_INTERNATIONAL7;
2404 if (k == Scancode::internat_8)
2405 return SDL_SCANCODE_INTERNATIONAL8;
2406 if (k == Scancode::internat_9)
2407 return SDL_SCANCODE_INTERNATIONAL9;
2408 if (k == Scancode::lang_1)
2409 return SDL_SCANCODE_LANG1;
2410 if (k == Scancode::lang_2)
2411 return SDL_SCANCODE_LANG2;
2412 if (k == Scancode::lang_3)
2413 return SDL_SCANCODE_LANG3;
2414 if (k == Scancode::lang_4)
2415 return SDL_SCANCODE_LANG4;
2416 if (k == Scancode::lang_5)
2417 return SDL_SCANCODE_LANG5;
2418 if (k == Scancode::lang_6)
2419 return SDL_SCANCODE_LANG6;
2420 if (k == Scancode::lang_7)
2421 return SDL_SCANCODE_LANG7;
2422 if (k == Scancode::lang_8)
2423 return SDL_SCANCODE_LANG8;
2424 if (k == Scancode::lang_9)
2425 return SDL_SCANCODE_LANG9;
2427 if (k == Scancode::altErase)
2428 return SDL_SCANCODE_ALTERASE;
2429 if (k == Scancode::sysrq)
2430 return SDL_SCANCODE_SYSREQ;
2431 if (k == Scancode::cancel)
2432 return SDL_SCANCODE_CANCEL;
2433 if (k == Scancode::clear)
2434 return SDL_SCANCODE_CLEAR;
2435 if (k == Scancode::prior)
2436 return SDL_SCANCODE_PRIOR;
2437 if (k == Scancode::enter2)
2438 return SDL_SCANCODE_RETURN2;
2439 if (k == Scancode::separator)
2440 return SDL_SCANCODE_SEPARATOR;
2441 if (k == Scancode::out)
2442 return SDL_SCANCODE_OUT;
2443 if (k == Scancode::oper)
2444 return SDL_SCANCODE_OPER;
2445 if (k == Scancode::clearAgain)
2446 return SDL_SCANCODE_CLEARAGAIN;
2447 if (k == Scancode::crsel)
2448 return SDL_SCANCODE_CRSEL;
2449 if (k == Scancode::exsel)
2450 return SDL_SCANCODE_EXSEL;
2452 if (k == Scancode::kp_00)
2453 return SDL_SCANCODE_KP_00;
2454 if (k == Scancode::kp_000)
2455 return SDL_SCANCODE_KP_000;
2456 if (k == Scancode::thousandsSeparator)
2457 return SDL_SCANCODE_THOUSANDSSEPARATOR;
2458 if (k == Scancode::decimalSeparator)
2459 return SDL_SCANCODE_DECIMALSEPARATOR;
2460 if (k == Scancode::currency_unit)
2461 return SDL_SCANCODE_CURRENCYUNIT;
2462 if (k == Scancode::currency_subunit)
2463 return SDL_SCANCODE_CURRENCYSUBUNIT;
2464 if (k == Scancode::kp_leftParen)
2465 return SDL_SCANCODE_KP_LEFTPAREN;
2466 if (k == Scancode::kp_rightParen)
2467 return SDL_SCANCODE_KP_RIGHTPAREN;
2468 if (k == Scancode::kp_leftBrace)
2469 return SDL_SCANCODE_KP_LEFTBRACE;
2470 if (k == Scancode::kp_rightBrace)
2471 return SDL_SCANCODE_KP_RIGHTBRACE;
2472 if (k == Scancode::kp_tab)
2473 return SDL_SCANCODE_KP_TAB;
2474 if (k == Scancode::kp_backspace)
2475 return SDL_SCANCODE_KP_BACKSPACE;
2476 if (k == Scancode::kp_a)
2477 return SDL_SCANCODE_KP_A;
2478 if (k == Scancode::kp_b)
2479 return SDL_SCANCODE_KP_B;
2480 if (k == Scancode::kp_c)
2481 return SDL_SCANCODE_KP_C;
2482 if (k == Scancode::kp_d)
2483 return SDL_SCANCODE_KP_D;
2484 if (k == Scancode::kp_e)
2485 return SDL_SCANCODE_KP_E;
2486 if (k == Scancode::kp_f)
2487 return SDL_SCANCODE_KP_F;
2488 if (k == Scancode::kp_xor)
2489 return SDL_SCANCODE_KP_XOR;
2490 if (k == Scancode::kp_power)
2491 return SDL_SCANCODE_KP_POWER;
2492 if (k == Scancode::kp_percent)
2493 return SDL_SCANCODE_KP_PERCENT;
2494 if (k == Scancode::kp_less)
2495 return SDL_SCANCODE_KP_LESS;
2496 if (k == Scancode::kp_greater)
2497 return SDL_SCANCODE_KP_GREATER;
2498 if (k == Scancode::kp_ampersand)
2499 return SDL_SCANCODE_KP_AMPERSAND;
2500 if (k == Scancode::kp_doubleAmpersand)
2501 return SDL_SCANCODE_KP_DBLAMPERSAND;
2502 if (k == Scancode::kp_vbar)
2503 return SDL_SCANCODE_KP_VERTICALBAR;
2504 if (k == Scancode::kp_doubleVbar)
2505 return SDL_SCANCODE_KP_DBLVERTICALBAR;
2506 if (k == Scancode::kp_colon)
2507 return SDL_SCANCODE_KP_COLON;
2508 if (k == Scancode::kp_hash)
2509 return SDL_SCANCODE_KP_HASH;
2510 if (k == Scancode::kp_space)
2511 return SDL_SCANCODE_KP_SPACE;
2512 if (k == Scancode::kp_at)
2513 return SDL_SCANCODE_KP_AT;
2514 if (k == Scancode::kp_exclamationPoint)
2515 return SDL_SCANCODE_KP_EXCLAM;
2516 if (k == Scancode::kp_mem_store)
2517 return SDL_SCANCODE_KP_MEMSTORE;
2518 if (k == Scancode::kp_mem_recall)
2519 return SDL_SCANCODE_KP_MEMRECALL;
2520 if (k == Scancode::kp_mem_clear)
2521 return SDL_SCANCODE_KP_MEMCLEAR;
2522 if (k == Scancode::kp_mem_add)
2523 return SDL_SCANCODE_KP_MEMADD;
2524 if (k == Scancode::kp_mem_subtract)
2525 return SDL_SCANCODE_KP_MEMSUBTRACT;
2526 if (k == Scancode::kp_mem_multiply)
2527 return SDL_SCANCODE_KP_MEMMULTIPLY;
2528 if (k == Scancode::kp_mem_divide)
2529 return SDL_SCANCODE_KP_MEMDIVIDE;
2530 if (k == Scancode::kp_plusMinus)
2531 return SDL_SCANCODE_KP_PLUSMINUS;
2532 if (k == Scancode::kp_mem_clear)
2533 return SDL_SCANCODE_KP_CLEAR;
2534 if (k == Scancode::kp_clearEntry)
2535 return SDL_SCANCODE_KP_CLEARENTRY;
2536 if (k == Scancode::kp_bin)
2537 return SDL_SCANCODE_KP_BINARY;
2538 if (k == Scancode::kp_octal)
2539 return SDL_SCANCODE_KP_OCTAL;
2540 if (k == Scancode::kp_decimal)
2541 return SDL_SCANCODE_KP_DECIMAL;
2542 if (k == Scancode::kp_hex)
2543 return SDL_SCANCODE_KP_HEXADECIMAL;
2545 if (k == Scancode::lctrl)
2546 return SDL_SCANCODE_LCTRL;
2547 if (k == Scancode::lshift)
2548 return SDL_SCANCODE_LSHIFT;
2549 if (k == Scancode::lalt)
2550 return SDL_SCANCODE_LALT;
2551 if (k == Scancode::lgui)
2552 return SDL_SCANCODE_LGUI;
2553 if (k == Scancode::rctrl)
2554 return SDL_SCANCODE_RCTRL;
2555 if (k == Scancode::rshift)
2556 return SDL_SCANCODE_RSHIFT;
2557 if (k == Scancode::ralt)
2558 return SDL_SCANCODE_RALT;
2559 if (k == Scancode::rgui)
2560 return SDL_SCANCODE_RGUI;
2562 if (k == Scancode::mode)
2563 return SDL_SCANCODE_MODE;
2565 if (k == Scancode::audio_next)
2566 return SDL_SCANCODE_AUDIONEXT;
2567 if (k == Scancode::audio_prev)
2568 return SDL_SCANCODE_AUDIOPREV;
2569 if (k == Scancode::audio_stop)
2570 return SDL_SCANCODE_AUDIOSTOP;
2571 if (k == Scancode::audio_play)
2572 return SDL_SCANCODE_AUDIOPLAY;
2573 if (k == Scancode::audio_mute)
2574 return SDL_SCANCODE_AUDIOMUTE;
2575 if (k == Scancode::mediaSelect)
2576 return SDL_SCANCODE_MEDIASELECT;
2577 if (k == Scancode::www)
2578 return SDL_SCANCODE_WWW;
2579 if (k == Scancode::mail)
2580 return SDL_SCANCODE_MAIL;
2581 if (k == Scancode::calculator)
2582 return SDL_SCANCODE_CALCULATOR;
2583 if (k == Scancode::computer)
2584 return SDL_SCANCODE_COMPUTER;
2585 if (k == Scancode::ac_search)
2586 return SDL_SCANCODE_AC_SEARCH;
2587 if (k == Scancode::ac_home)
2588 return SDL_SCANCODE_AC_HOME;
2589 if (k == Scancode::ac_back)
2590 return SDL_SCANCODE_AC_BACK;
2591 if (k == Scancode::ac_fwd)
2592 return SDL_SCANCODE_AC_FORWARD;
2593 if (k == Scancode::ac_stop)
2594 return SDL_SCANCODE_AC_STOP;
2595 if (k == Scancode::ac_refresh)
2596 return SDL_SCANCODE_AC_REFRESH;
2597 if (k == Scancode::ac_bookmarks)
2598 return SDL_SCANCODE_AC_BOOKMARKS;
2600 if (k == Scancode::brightnessDown)
2601 return SDL_SCANCODE_BRIGHTNESSDOWN;
2602 if (k == Scancode::brightnessUp)
2603 return SDL_SCANCODE_BRIGHTNESSUP;
2604 if (k == Scancode::displaySwitch)
2605 return SDL_SCANCODE_DISPLAYSWITCH;
2606 if (k == Scancode::kb_illum_toggle)
2607 return SDL_SCANCODE_KBDILLUMTOGGLE;
2608 if (k == Scancode::kb_illum_down)
2609 return SDL_SCANCODE_KBDILLUMDOWN;
2610 if (k == Scancode::kb_illum_up)
2611 return SDL_SCANCODE_KBDILLUMUP;
2612 if (k == Scancode::eject)
2613 return SDL_SCANCODE_EJECT;
2614 if (k == Scancode::sleep)
2615 return SDL_SCANCODE_SLEEP;
2617 if (k == Scancode::app1)
2618 return SDL_SCANCODE_APP1;
2619 if (k == Scancode::app2)
2620 return SDL_SCANCODE_APP2;
2622 if (k == Scancode::audio_rewind)
2623 return SDL_SCANCODE_AUDIOREWIND;
2624 if (k == Scancode::audio_fastforward)
2625 return SDL_SCANCODE_AUDIOFASTFORWARD;
2627 return SDL_SCANCODE_UNKNOWN;