StuBS
|
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 |
Class that abstracts a key, made up of the scan code and the modifier bits.
enum Key::Scancode : uint8_t |
The keys' scan codes (code 1)
|
inline |
Default constructor: Instantiates an invalid key by setting ASCII, scan code, and modifier bits to 0.
|
inline |
Invalid keys have a scancode = 0.
|
inline |
Marks the key as invalid by setting the scan code to 0.
unsigned char Key::ascii | ( | ) | const |
Get the key's ASCII value.
|
inline |
Indicates whether the ALT modifier is set.
true
if ALT key was pressed during key press
|
inline |
Indicates whether the CTRL modifier is set.
true
if CTRL key was pressed during key press
|
inline |
Conversion to char (ASCII code)
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 |