StuBS
Key Struct Reference

Class that abstracts a key, made up of the scan code and the modifier bits. More...

#include <key.h>

Public Types

enum  Scancode : uint8_t
 The keys' scan codes (code 1)
 

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)
 

Detailed Description

Class that abstracts a key, made up of the scan code and the modifier bits.

Member Function Documentation

◆ alt()

bool Key::alt ( ) const
inline

Indicates whether the ALT modifier is set.

Returns
true if ALT key was pressed during key press

◆ ascii()

unsigned char Key::ascii ( ) const

Get the key's ASCII value.

Returns
the key's ASCII value

◆ ctrl()

bool Key::ctrl ( ) const
inline

Indicates whether the CTRL modifier is set.

Returns
true if CTRL key was pressed during key press

◆ valid()

bool Key::valid ( ) const
inline

Invalid keys have a scancode = 0.

Returns
Checks whether a key is valid.

The documentation for this struct was generated from the following files: