class
#include <Magnum/Platform/Sdl2Application.h>
KeyEvent Key event.
Contents
Base classes
- class InputEvent
- Base for input events.
Public types
- enum class Key: SDL_Keycode { Unknown = SDLK_UNKNOWN, LeftShift = SDLK_LSHIFT, RightShift = SDLK_RSHIFT, LeftCtrl = SDLK_LCTRL, RightCtrl = SDLK_RCTRL, LeftAlt = SDLK_LALT, RightAlt = SDLK_RALT, LeftSuper = SDLK_LGUI, RightSuper = SDLK_RGUI, AltGr = SDLK_MODE, Enter = SDLK_RETURN, Esc = SDLK_ESCAPE, Up = SDLK_UP, Down = SDLK_DOWN, Left = SDLK_LEFT, Right = SDLK_RIGHT, Home = SDLK_HOME, End = SDLK_END, PageUp = SDLK_PAGEUP, PageDown = SDLK_PAGEDOWN, Backspace = SDLK_BACKSPACE, Insert = SDLK_INSERT, Delete = SDLK_DELETE, F1 = SDLK_F1, F2 = SDLK_F2, F3 = SDLK_F3, F4 = SDLK_F4, F5 = SDLK_F5, F6 = SDLK_F6, F7 = SDLK_F7, F8 = SDLK_F8, F9 = SDLK_F9, F10 = SDLK_F10, F11 = SDLK_F11, F12 = SDLK_F12, Space = SDLK_SPACE, Tab = SDLK_TAB, Quote = SDLK_QUOTE new in 2020.06, Comma = SDLK_COMMA, Period = SDLK_PERIOD, Minus = SDLK_MINUS, Plus = SDLK_PLUS, Slash = SDLK_SLASH, Percent = SDLK_PERCENT, Semicolon = SDLK_SEMICOLON, Equal = SDLK_EQUALS, LeftBracket = SDLK_LEFTBRACKET new in 2020.06, RightBracket = SDLK_RIGHTBRACKET new in 2020.06, Backslash = SDLK_BACKSLASH new in 2020.06, Backquote = SDLK_BACKQUOTE new in 2020.06, Zero = SDLK_0, One = SDLK_1, Two = SDLK_2, Three = SDLK_3, Four = SDLK_4, Five = SDLK_5, Six = SDLK_6, Seven = SDLK_7, Eight = SDLK_8, Nine = SDLK_9, A = SDLK_a, B = SDLK_b, C = SDLK_c, D = SDLK_d, E = SDLK_e, F = SDLK_f, G = SDLK_g, H = SDLK_h, I = SDLK_i, J = SDLK_j, K = SDLK_k, L = SDLK_l, M = SDLK_m, N = SDLK_n, O = SDLK_o, P = SDLK_p, Q = SDLK_q, R = SDLK_r, S = SDLK_s, T = SDLK_t, U = SDLK_u, V = SDLK_v, W = SDLK_w, X = SDLK_x, Y = SDLK_y, Z = SDLK_z, NumZero = SDLK_KP_0, NumOne = SDLK_KP_1, NumTwo = SDLK_KP_2, NumThree = SDLK_KP_3, NumFour = SDLK_KP_4, NumFive = SDLK_KP_5, NumSix = SDLK_KP_6, NumSeven = SDLK_KP_7, NumEight = SDLK_KP_8, NumNine = SDLK_KP_9, NumDecimal = SDLK_KP_DECIMAL, NumDivide = SDLK_KP_DIVIDE, NumMultiply = SDLK_KP_MULTIPLY, NumSubtract = SDLK_KP_MINUS, NumAdd = SDLK_KP_PLUS, NumEnter = SDLK_KP_ENTER, NumEqual = SDLK_KP_EQUALS }
- Key.
Public static functions
-
static auto keyName(Key key) -> std::
string - Name for given key.
Public functions
- auto key() const -> Key
- Key.
-
auto keyName() const -> std::
string - Key name.
- auto modifiers() const -> Modifiers
- Modifiers.
- auto isRepeated() const -> bool
- Whether the key press is repeated.
Enum documentation
enum class Magnum:: Platform:: Sdl2Application:: KeyEvent:: Key: SDL_Keycode
Key.
Enumerators | |
---|---|
Unknown |
Unknown key |
LeftShift |
Left Shift |
RightShift |
Right Shift |
LeftCtrl |
Left Ctrl |
RightCtrl |
Right Ctrl |
LeftAlt |
Left Alt |
RightAlt |
Right Alt |
LeftSuper |
Left Super key (Windows/⌘) |
RightSuper |
Right Super key (Windows/⌘) |
AltGr |
AltGr |
Enter |
Enter |
Esc |
Escape |
Up |
Up arrow |
Down |
Down arrow |
Left |
Left arrow |
Right |
Right arrow |
Home |
Home |
End |
End |
PageUp |
Page up |
PageDown |
Page down |
Backspace |
Backspace |
Insert |
Insert |
Delete |
Delete |
F1 |
F1 |
F2 |
F2 |
F3 |
F3 |
F4 |
F4 |
F5 |
F5 |
F6 |
F6 |
F7 |
F7 |
F8 |
F8 |
F9 |
F9 |
F10 |
F10 |
F11 |
F11 |
F12 |
F12 |
Space |
Space |
Tab |
Tab |
Quote new in 2020.06 |
Quote ( |
Comma |
Comma |
Period |
Period |
Minus |
Minus |
Plus |
Plus |
Slash |
Slash |
Percent |
Percent |
Semicolon |
Semicolon ( |
Equal |
Equal |
LeftBracket new in 2020.06 |
Left bracket ( |
RightBracket new in 2020.06 |
Right bracket ( |
Backslash new in 2020.06 |
Backslash ( |
Backquote new in 2020.06 |
Backquote ( |
Zero |
Zero |
One |
One |
Two |
Two |
Three |
Three |
Four |
Four |
Five |
Five |
Six |
Six |
Seven |
Seven |
Eight |
Eight |
Nine |
Nine |
A |
Letter A |
B |
Letter B |
C |
Letter C |
D |
Letter D |
E |
Letter E |
F |
Letter F |
G |
Letter G |
H |
Letter H |
I |
Letter I |
J |
Letter J |
K |
Letter K |
L |
Letter L |
M |
Letter M |
N |
Letter N |
O |
Letter O |
P |
Letter P |
Q |
Letter Q |
R |
Letter R |
S |
Letter S |
T |
Letter T |
U |
Letter U |
V |
Letter V |
W |
Letter W |
X |
Letter X |
Y |
Letter Y |
Z |
Letter Z |
NumZero |
Numpad zero |
NumOne |
Numpad one |
NumTwo |
Numpad two |
NumThree |
Numpad three |
NumFour |
Numpad four |
NumFive |
Numpad five |
NumSix |
Numpad six |
NumSeven |
Numpad seven |
NumEight |
Numpad eight |
NumNine |
Numpad nine |
NumDecimal |
Numpad decimal |
NumDivide |
Numpad divide |
NumMultiply |
Numpad multiply |
NumSubtract |
Numpad subtract |
NumAdd |
Numpad add |
NumEnter |
Numpad enter |
NumEqual |
Numpad equal |
Function documentation
static std:: string Magnum:: Platform:: Sdl2Application:: KeyEvent:: keyName(Key key)
Name for given key.
Human-readable localized UTF-8 name for given key
, intended for displaying to the user in e.g. key binding configuration. If there is no name for given key, empty string is returned.
std:: string Magnum:: Platform:: Sdl2Application:: KeyEvent:: keyName() const
Key name.
Human-readable localized UTF-8 name for the key returned by key(), intended for displaying to the user in e.g. key binding configuration. If there is no name for that key, empty string is returned.
bool Magnum:: Platform:: Sdl2Application:: KeyEvent:: isRepeated() const
Whether the key press is repeated.
Returns true
if the key press event is repeated, false
if not or if this was key release event.