1.10
Public Types | Public Member Functions | Public Attributes | List of all members
Key Struct Reference

Keyboard event data. More...

#include <event.h>

Public Types

enum class  KeyMod : uint32_t { shift = detail::bit(0) , control = detail::bit(1) , lock = detail::bit(2) }
 
using KeyState = egt::Flags< KeyMod >
 

Public Member Functions

constexpr Key () noexcept=default
 
constexpr Key (KeyboardCode k, uint32_t u=0, const KeyState &s={}) noexcept
 

Public Attributes

KeyboardCode keycode {EKEY_UNKNOWN}
 Key code value.
 
KeyState state {}
 Key state.
 
uint32_t unicode {0}
 32 bit unicode code point.
 

Detailed Description

Keyboard event data.

Member Typedef Documentation

◆ KeyState

Member Enumeration Documentation

◆ KeyMod

enum class KeyMod : uint32_t
strong
Enumerator
shift 
control 
lock 

Constructor & Destructor Documentation

◆ Key() [1/2]

constexpr Key ( )
constexprdefaultnoexcept

◆ Key() [2/2]

constexpr Key ( KeyboardCode  k,
uint32_t  u = 0,
const KeyState s = {} 
)
inlineexplicitconstexprnoexcept
Parameters
[in]kKey code for the event.
[in]uUnicode value of the event.

Member Data Documentation

◆ keycode

Key code value.

This is basically the physical key that was pressed.

Any idea of a scancode or keysym is handled by the input backends themselves, which truly represent physical keys and are used for mappings.

See also
KeyboardCode

◆ state

KeyState state {}

Key state.

A bitmask of key modifiers such as SHIFT, CONTROL or LOCK keys.

◆ unicode

uint32_t unicode {0}

32 bit unicode code point.