Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename KeyCode value names #1226

Merged
merged 9 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 154 additions & 154 deletions NAS2D/EnumKeyCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,175 +18,175 @@ namespace NAS2D
{
enum class KeyCode : uint32_t
{
KEY_FIRST = 0,
KEY_UNKNOWN = 0,
KEY_BACKSPACE = '\b',
KEY_TAB = '\t',
KEY_RETURN = '\r',
KEY_ENTER = '\r',
KEY_ESCAPE = '\033',
KEY_SPACE = ' ',
KEY_EXCLAIM = '!',
KEY_QUOTEDBL = '"',
KEY_HASH = '#',
KEY_PERCENT = '%',
KEY_DOLLAR = '$',
KEY_AMPERSAND = '&',
KEY_QUOTE = '\'',
KEY_LEFTPAREN = '(',
KEY_RIGHTPAREN = ')',
KEY_ASTERISK = '*',
KEY_PLUS = '+',
KEY_COMMA = ',',
KEY_MINUS = '-',
KEY_PERIOD = '.',
KEY_SLASH = '/',
KEY_0 = '0',
KEY_1 = '1',
KEY_2 = '2',
KEY_3 = '3',
KEY_4 = '4',
KEY_5 = '5',
KEY_6 = '6',
KEY_7 = '7',
KEY_8 = '8',
KEY_9 = '9',
KEY_COLON = ':',
KEY_SEMICOLON = ';',
KEY_LESS = '<',
KEY_EQUALS = '=',
KEY_GREATER = '>',
KEY_QUESTION = '?',
KEY_AT = '@',
First = 0,
Unknown = 0,
Backspace = '\b',
Tab = '\t',
Return = '\r',
Enter = '\r',
Escape = '\033',
Space = ' ',
Exclaim = '!',
Quote = '"',
Hash = '#',
Percent = '%',
Dollar = '$',
Ampersand = '&',
SingleQuote = '\'',
LeftParen = '(',
RightParen = ')',
Asterisk = '*',
Plus = '+',
Comma = ',',
Minus = '-',
Period = '.',
Slash = '/',
Num0 = '0',
Num1 = '1',
Num2 = '2',
Num3 = '3',
Num4 = '4',
Num5 = '5',
Num6 = '6',
Num7 = '7',
Num8 = '8',
Num9 = '9',
Colon = ':',
Semicolon = ';',
Less = '<',
Equal = '=',
Greater = '>',
Question = '?',
At = '@',

// Special Symbols
KEY_LEFTBRACKET = '[',
KEY_BACKSLASH = '\\',
KEY_RIGHTBRACKET = ']',
KEY_CARET = '^',
KEY_UNDERSCORE = '_',
KEY_BACKQUOTE = '`',
LeftBracket = '[',
Backslash = '\\',
RightBracket = ']',
Caret = '^',
Underscore = '_',
Backquote = '`',

KEY_a = 'a',
KEY_b = 'b',
KEY_c = 'c',
KEY_d = 'd',
KEY_e = 'e',
KEY_f = 'f',
KEY_g = 'g',
KEY_h = 'h',
KEY_i = 'i',
KEY_j = 'j',
KEY_k = 'k',
KEY_l = 'l',
KEY_m = 'm',
KEY_n = 'n',
KEY_o = 'o',
KEY_p = 'p',
KEY_q = 'q',
KEY_r = 'r',
KEY_s = 's',
KEY_t = 't',
KEY_u = 'u',
KEY_v = 'v',
KEY_w = 'w',
KEY_x = 'x',
KEY_y = 'y',
KEY_z = 'z',
A = 'a',
B = 'b',
C = 'c',
D = 'd',
E = 'e',
F = 'f',
G = 'g',
H = 'h',
I = 'i',
J = 'j',
K = 'k',
L = 'l',
M = 'm',
N = 'n',
O = 'o',
P = 'p',
Q = 'q',
R = 'r',
S = 's',
T = 't',
U = 'u',
V = 'v',
W = 'w',
X = 'x',
Y = 'y',
Z = 'z',

// Numeric Keypad
KEY_KP1 = scanCodeToKeyCode(89),
KEY_KP2 = scanCodeToKeyCode(90),
KEY_KP3 = scanCodeToKeyCode(91),
KEY_KP4 = scanCodeToKeyCode(92),
KEY_KP5 = scanCodeToKeyCode(93),
KEY_KP6 = scanCodeToKeyCode(94),
KEY_KP7 = scanCodeToKeyCode(95),
KEY_KP8 = scanCodeToKeyCode(96),
KEY_KP9 = scanCodeToKeyCode(97),
KEY_KP0 = scanCodeToKeyCode(98),
KEY_KP_PERIOD = scanCodeToKeyCode(99),
KEY_KP_DIVIDE = scanCodeToKeyCode(84),
KEY_KP_MULTIPLY = scanCodeToKeyCode(85),
KEY_KP_MINUS = scanCodeToKeyCode(86),
KEY_KP_PLUS = scanCodeToKeyCode(87),
KEY_KP_ENTER = scanCodeToKeyCode(88),
KEY_KP_EQUALS = scanCodeToKeyCode(103),
KEY_KP_COMMA = scanCodeToKeyCode(133),
Keypad1 = scanCodeToKeyCode(89),
Keypad2 = scanCodeToKeyCode(90),
Keypad3 = scanCodeToKeyCode(91),
Keypad4 = scanCodeToKeyCode(92),
Keypad5 = scanCodeToKeyCode(93),
Keypad6 = scanCodeToKeyCode(94),
Keypad7 = scanCodeToKeyCode(95),
Keypad8 = scanCodeToKeyCode(96),
Keypad9 = scanCodeToKeyCode(97),
Keypad0 = scanCodeToKeyCode(98),
KeypadPeriod = scanCodeToKeyCode(99),
KeypadDivide = scanCodeToKeyCode(84),
KeypadMultiply = scanCodeToKeyCode(85),
KeypadMinus = scanCodeToKeyCode(86),
KeypadPlus = scanCodeToKeyCode(87),
KeypadEnter = scanCodeToKeyCode(88),
KeypadEqual = scanCodeToKeyCode(103),
KeypadComma = scanCodeToKeyCode(133),

// Arrows/Home/End
KEY_UP = scanCodeToKeyCode(82),
KEY_DOWN = scanCodeToKeyCode(81),
KEY_RIGHT = scanCodeToKeyCode(79),
KEY_LEFT = scanCodeToKeyCode(80),
KEY_INSERT = scanCodeToKeyCode(73),
KEY_PAUSE = scanCodeToKeyCode(72),
KEY_HOME = scanCodeToKeyCode(74),
KEY_END = scanCodeToKeyCode(77),
KEY_DELETE = '\177',
KEY_PAGEUP = scanCodeToKeyCode(75),
KEY_PAGEDOWN = scanCodeToKeyCode(78),
Up = scanCodeToKeyCode(82),
Down = scanCodeToKeyCode(81),
Right = scanCodeToKeyCode(79),
Left = scanCodeToKeyCode(80),
Insert = scanCodeToKeyCode(73),
Pause = scanCodeToKeyCode(72),
Home = scanCodeToKeyCode(74),
End = scanCodeToKeyCode(77),
Delete = '\177',
PageUp = scanCodeToKeyCode(75),
PageDown = scanCodeToKeyCode(78),

// Function Keys
KEY_F1 = scanCodeToKeyCode(58),
KEY_F2 = scanCodeToKeyCode(59),
KEY_F3 = scanCodeToKeyCode(60),
KEY_F4 = scanCodeToKeyCode(61),
KEY_F5 = scanCodeToKeyCode(62),
KEY_F6 = scanCodeToKeyCode(63),
KEY_F7 = scanCodeToKeyCode(64),
KEY_F8 = scanCodeToKeyCode(65),
KEY_F9 = scanCodeToKeyCode(66),
KEY_F10 = scanCodeToKeyCode(67),
KEY_F11 = scanCodeToKeyCode(68),
KEY_F12 = scanCodeToKeyCode(69),
KEY_F13 = scanCodeToKeyCode(104),
KEY_F14 = scanCodeToKeyCode(105),
KEY_F15 = scanCodeToKeyCode(106),
KEY_F16 = scanCodeToKeyCode(107),
KEY_F17 = scanCodeToKeyCode(108),
KEY_F18 = scanCodeToKeyCode(109),
KEY_F19 = scanCodeToKeyCode(110),
KEY_F20 = scanCodeToKeyCode(111),
KEY_F21 = scanCodeToKeyCode(112),
KEY_F22 = scanCodeToKeyCode(113),
KEY_F23 = scanCodeToKeyCode(114),
KEY_F24 = scanCodeToKeyCode(115),
F1 = scanCodeToKeyCode(58),
F2 = scanCodeToKeyCode(59),
F3 = scanCodeToKeyCode(60),
F4 = scanCodeToKeyCode(61),
F5 = scanCodeToKeyCode(62),
F6 = scanCodeToKeyCode(63),
F7 = scanCodeToKeyCode(64),
F8 = scanCodeToKeyCode(65),
F9 = scanCodeToKeyCode(66),
F10 = scanCodeToKeyCode(67),
F11 = scanCodeToKeyCode(68),
F12 = scanCodeToKeyCode(69),
F13 = scanCodeToKeyCode(104),
F14 = scanCodeToKeyCode(105),
F15 = scanCodeToKeyCode(106),
F16 = scanCodeToKeyCode(107),
F17 = scanCodeToKeyCode(108),
F18 = scanCodeToKeyCode(109),
F19 = scanCodeToKeyCode(110),
F20 = scanCodeToKeyCode(111),
F21 = scanCodeToKeyCode(112),
F22 = scanCodeToKeyCode(113),
F23 = scanCodeToKeyCode(114),
F24 = scanCodeToKeyCode(115),

// Key State Modifiers
KEY_NUMLOCK = scanCodeToKeyCode(83),
KEY_CAPSLOCK = scanCodeToKeyCode(57),
KEY_SCROLLOCK = scanCodeToKeyCode(71),
KEY_RSHIFT = scanCodeToKeyCode(229),
KEY_LSHIFT = scanCodeToKeyCode(225),
KEY_RCTRL = scanCodeToKeyCode(228),
KEY_LCTRL = scanCodeToKeyCode(224),
KEY_RALT = scanCodeToKeyCode(230),
KEY_LALT = scanCodeToKeyCode(226),
KEY_RGUI = scanCodeToKeyCode(231),
KEY_LGUI = scanCodeToKeyCode(227),
KEY_MODE = scanCodeToKeyCode(257),
NumLock = scanCodeToKeyCode(83),
CapsLock = scanCodeToKeyCode(57),
ScrollLock = scanCodeToKeyCode(71),
RightShift = scanCodeToKeyCode(229),
LeftShift = scanCodeToKeyCode(225),
RightCtrl = scanCodeToKeyCode(228),
LeftCtrl = scanCodeToKeyCode(224),
RightAlt = scanCodeToKeyCode(230),
LeftAlt = scanCodeToKeyCode(226),
RightGui = scanCodeToKeyCode(231),
LeftGui = scanCodeToKeyCode(227),
Mode = scanCodeToKeyCode(257),

// Miscellaneous function keys
KEY_HELP = scanCodeToKeyCode(117),
KEY_PRINTSCREEN = scanCodeToKeyCode(70),
KEY_ALTERASE = scanCodeToKeyCode(153),
KEY_SYSREQ = scanCodeToKeyCode(154),
KEY_CLEAR = scanCodeToKeyCode(159),
KEY_MENU = scanCodeToKeyCode(118),
KEY_POWER = scanCodeToKeyCode(102),
KEY_UNDO = scanCodeToKeyCode(122),
Help = scanCodeToKeyCode(117),
PrintScreen = scanCodeToKeyCode(70),
AltErase = scanCodeToKeyCode(153),
SysReq = scanCodeToKeyCode(154),
Clear = scanCodeToKeyCode(159),
Menu = scanCodeToKeyCode(118),
Power = scanCodeToKeyCode(102),
Undo = scanCodeToKeyCode(122),

// Audio Control
KEY_MUTE = scanCodeToKeyCode(127),
KEY_VOLUME_UP = scanCodeToKeyCode(128),
KEY_VOLUME_DOWN = scanCodeToKeyCode(129),
KEY_AUDIO_NEXT = scanCodeToKeyCode(258),
KEY_AUDIO_PREV = scanCodeToKeyCode(259),
KEY_AUDIO_STOP = scanCodeToKeyCode(260),
KEY_AUDIO_PLAY = scanCodeToKeyCode(261),
KEY_AUDIO_MUTE = scanCodeToKeyCode(262),
Mute = scanCodeToKeyCode(127),
VolumeUp = scanCodeToKeyCode(128),
VolumeDown = scanCodeToKeyCode(129),
AudioNext = scanCodeToKeyCode(258),
AudioPrev = scanCodeToKeyCode(259),
AudioStop = scanCodeToKeyCode(260),
AudioPlay = scanCodeToKeyCode(261),
AudioMute = scanCodeToKeyCode(262),

KEY_LAST,
Last,
};
}
6 changes: 3 additions & 3 deletions test-graphics/TestGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ void TestGraphics::onKeyDown(NAS2D::KeyCode key, NAS2D::KeyModifier /*mod*/, boo
{
switch (key)
{
case NAS2D::KeyCode::KEY_ESCAPE:
case NAS2D::KeyCode::Escape:
NAS2D::postQuitEvent();
break;
case NAS2D::KeyCode::KEY_F1:
case NAS2D::KeyCode::F1:
{
auto& renderer = NAS2D::Utility<NAS2D::Renderer>::get();
renderer.fullscreen(!renderer.fullscreen());
break;
}
case NAS2D::KeyCode::KEY_F2:
case NAS2D::KeyCode::F2:
{
auto& renderer = NAS2D::Utility<NAS2D::Renderer>::get();
renderer.resizeable(!renderer.resizeable());
Expand Down