Key Struct Reference
Class that abstracts a key, made up of the scan code and the modifier bits. More...
#include <object/key.h>
Public Member Functions | |
| Key () | |
| Default constructor: Instantiates an invalid key by setting ASCII, scan code, and modifier bits to 0. | |
| bool | valid () const |
| Invalid keys have a scancode = 0. | |
| void | invalidate () |
| Marks the key as invalid by setting the scan code to 0. | |
| unsigned char | ascii () const |
| Get the key's ASCII value. | |
| bool | alt () const |
| Indicates whether the ALT modifier is set. | |
| bool | ctrl () const |
| Indicates whether the CTRL modifier is set. | |
| operator char () const | |
| Conversion to char (ASCII code) | |
Public Attributes | |
| Scancode | scancode |
| bool | shift: 1 |
| bool | alt_left: 1 |
| bool | alt_right: 1 |
| bool | ctrl_left: 1 |
| bool | ctrl_right: 1 |
| bool | caps_lock: 1 |
| bool | num_lock: 1 |
| bool | scroll_lock: 1 |
Detailed Description
Class that abstracts a key, made up of the scan code and the modifier bits.
Member Enumeration Documentation
| enum Key::Scancode : uint8_t |
The keys' scan codes (code 1)
Constructor & Destructor Documentation
|
inline |
Default constructor: Instantiates an invalid key by setting ASCII, scan code, and modifier bits to 0.
Member Function Documentation
|
inline |
Invalid keys have a scancode = 0.
- Returns
- Checks whether a key is valid.
|
inline |
Marks the key as invalid by setting the scan code to 0.
| unsigned char Key::ascii | ( | ) | const |
Get the key's ASCII value.
- Returns
- the key's ASCII value
|
inline |
Indicates whether the ALT modifier is set.
- Returns
trueif ALT key was pressed during key press
|
inline |
Indicates whether the CTRL modifier is set.
- Returns
trueif CTRL key was pressed during key press
|
inline |
Conversion to char (ASCII code)
Member Data Documentation
| Scancode Key::scancode |
| bool Key::shift |
| bool Key::alt_left |
| bool Key::alt_right |
| bool Key::ctrl_left |
| bool Key::ctrl_right |
| bool Key::caps_lock |
| bool Key::num_lock |
| bool Key::scroll_lock |
The documentation for this struct was generated from the following files: