Magnum::Platform::GlfwApplication::KeyEvent class

Key event.

Base classes

class InputEvent
Base for input events.

Public types

enum class Key: Int { Unknown = GLFW_KEY_UNKNOWN, LeftShift = GLFW_KEY_LEFT_SHIFT, RightShift = GLFW_KEY_RIGHT_SHIFT, LeftCtrl = GLFW_KEY_LEFT_CONTROL, RightCtrl = GLFW_KEY_RIGHT_CONTROL, LeftAlt = GLFW_KEY_LEFT_ALT, RightAlt = GLFW_KEY_RIGHT_ALT, LeftSuper = GLFW_KEY_LEFT_SUPER, RightSuper = GLFW_KEY_RIGHT_SUPER, Enter = GLFW_KEY_ENTER, Esc = GLFW_KEY_ESCAPE, Up = GLFW_KEY_UP, Down = GLFW_KEY_DOWN, Left = GLFW_KEY_LEFT, Right = GLFW_KEY_RIGHT, Home = GLFW_KEY_HOME, End = GLFW_KEY_END, PageUp = GLFW_KEY_PAGE_UP, PageDown = GLFW_KEY_PAGE_DOWN, Backspace = GLFW_KEY_BACKSPACE, Insert = GLFW_KEY_INSERT, Delete = GLFW_KEY_DELETE, F1 = GLFW_KEY_F1, F2 = GLFW_KEY_F2, F3 = GLFW_KEY_F3, F4 = GLFW_KEY_F4, F5 = GLFW_KEY_F5, F6 = GLFW_KEY_F6, F7 = GLFW_KEY_F7, F8 = GLFW_KEY_F8, F9 = GLFW_KEY_F9, F10 = GLFW_KEY_F10, F11 = GLFW_KEY_F11, F12 = GLFW_KEY_F12, Space = GLFW_KEY_SPACE, Tab = GLFW_KEY_TAB, Quote = GLFW_KEY_APOSTROPHE new in 2020.06, Comma = GLFW_KEY_COMMA, Period = GLFW_KEY_PERIOD, Minus = GLFW_KEY_MINUS, Plus = '+', Slash = GLFW_KEY_SLASH, Percent = '%', Semicolon = GLFW_KEY_SEMICOLON, Smicolon = Semicolon deprecated in 2019.01, Equal = GLFW_KEY_EQUAL, LeftBracket = GLFW_KEY_LEFT_BRACKET new in 2020.06, RightBracket = GLFW_KEY_RIGHT_BRACKET new in 2020.06, Backslash = GLFW_KEY_BACKSLASH new in 2020.06, Backquote = GLFW_KEY_GRAVE_ACCENT new in 2020.06, World1 = GLFW_KEY_WORLD_1 new in 2020.06, World2 = GLFW_KEY_WORLD_2 new in 2020.06, Zero = GLFW_KEY_0, One = GLFW_KEY_1, Two = GLFW_KEY_2, Three = GLFW_KEY_3, Four = GLFW_KEY_4, Five = GLFW_KEY_5, Six = GLFW_KEY_6, Seven = GLFW_KEY_7, Eight = GLFW_KEY_8, Nine = GLFW_KEY_9, A = GLFW_KEY_A, B = GLFW_KEY_B, C = GLFW_KEY_C, D = GLFW_KEY_D, E = GLFW_KEY_E, F = GLFW_KEY_F, G = GLFW_KEY_G, H = GLFW_KEY_H, I = GLFW_KEY_I, J = GLFW_KEY_J, K = GLFW_KEY_K, L = GLFW_KEY_L, M = GLFW_KEY_M, N = GLFW_KEY_N, O = GLFW_KEY_O, P = GLFW_KEY_P, Q = GLFW_KEY_Q, R = GLFW_KEY_R, S = GLFW_KEY_S, T = GLFW_KEY_T, U = GLFW_KEY_U, V = GLFW_KEY_V, W = GLFW_KEY_W, X = GLFW_KEY_X, Y = GLFW_KEY_Y, Z = GLFW_KEY_Z, CapsLock = GLFW_KEY_CAPS_LOCK, ScrollLock = GLFW_KEY_SCROLL_LOCK, NumLock = GLFW_KEY_NUM_LOCK, PrintScreen = GLFW_KEY_PRINT_SCREEN, Pause = GLFW_KEY_PAUSE, Menu = GLFW_KEY_MENU, NumZero = GLFW_KEY_KP_0, NumOne = GLFW_KEY_KP_1, NumTwo = GLFW_KEY_KP_2, NumThree = GLFW_KEY_KP_3, NumFour = GLFW_KEY_KP_4, NumFive = GLFW_KEY_KP_5, NumSix = GLFW_KEY_KP_6, NumSeven = GLFW_KEY_KP_7, NumEight = GLFW_KEY_KP_8, NumNine = GLFW_KEY_KP_9, NumDecimal = GLFW_KEY_KP_DECIMAL, NumDivide = GLFW_KEY_KP_DIVIDE, NumMultiply = GLFW_KEY_KP_MULTIPLY, NumSubtract = GLFW_KEY_KP_SUBTRACT, NumAdd = GLFW_KEY_KP_ADD, NumEnter = GLFW_KEY_KP_ENTER, NumEqual = GLFW_KEY_KP_EQUAL }
Key.

Public static functions

static auto keyName(Key key) -> Containers::StringView
Name for given key.

Public functions

auto key() const -> Key
Key.
auto keyName() const -> Containers::StringView
Key name.
auto modifiers() const -> Modifiers
Modifiers.
auto isRepeated() const -> bool
Whether the key press is repeated.

Enum documentation

enum class Magnum::Platform::GlfwApplication::KeyEvent::Key: Int

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/⌘)

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 (;)

Smicolon

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 (`)

World1 new in 2020.06

Non-US #1. Can be for example a backslash (\) next to left Shift.

World2 new in 2020.06

Non-US #2

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

CapsLock

Caps lock

ScrollLock

Scroll lock

NumLock

Num lock

PrintScreen

Print screen

Pause

Pause

Menu

Menu

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 Containers::StringView Magnum::Platform::GlfwApplication::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. The returned view is always Containers::StringViewFlag::NullTerminated and is valid until the keyboard layout is changed or the application exits.

Key Magnum::Platform::GlfwApplication::KeyEvent::key() const

Key.

Containers::StringView Magnum::Platform::GlfwApplication::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. The returned view is always Containers::StringViewFlag::NullTerminated and is valid until the keyboard layout is changed or the application exits.

bool Magnum::Platform::GlfwApplication::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.