Robot Devastation
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members

Class that represents a keyboard key. More...

#include <Key.hpp>

Public Member Functions

 Key (char printable_character)
 
 Key (int control_key)
 
bool isControlKey () const
 
bool isPrintable () const
 
char getChar () const
 
int getValue () const
 
bool operator== (Key const &k) const
 

Static Public Attributes

static const int KEY_UNKNOWN = -1
 Constant representing a non-supported / unknown key.
 
static const int KEY_PRINTABLE = 0
 Constant representing any printable key.
 
static const int KEY_SPACE = 1
 
static const int KEY_ESCAPE = 2
 
static const int KEY_BACKSPACE = 3
 
static const int KEY_ARROW_UP = 4
 
static const int KEY_ARROW_DOWN = 5
 
static const int KEY_ARROW_LEFT = 6
 
static const int KEY_ARROW_RIGHT = 7
 
static const int KEY_ENTER = 8
 

Protected Attributes

char char_value
 Stores the char representation of a key.
 
int key_value
 Stores the control key value of a key.
 
bool printable
 Stores whether the key is printable or not.
 
bool control
 Stores whether the key is a control key or not.
 

Detailed Description

Keys are classified in two groups: printable keys, which are keys that have a char representation, such as the 'a' key or the '7' key, and control keys, which are keys that perform an action, such as the arrow keys, the escape key or the backspace key. The space case is a special case, because it is considered both printable and control key.

This class must not be inherited from. Use factory classes and functions to perform custom initialization (see rd::SDLEventFactory).


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