#include <Keyboard.h>
Inherits SubsystemInterface.
Inherited by DirectInputKeyboard.
Public Types | |
| enum | { MAX_KEY_STATES = 3 } |
Public Member Functions | |
| Keyboard (void) | |
| virtual | ~Keyboard (void) |
| virtual void | init (void) |
| virtual void | reset (void) |
| Reset keyboard system. | |
| virtual void | update (void) |
| virtual Bool | getCapsState (void)=0 |
| get state of caps lock key, return TRUE if down | |
| virtual void | createStreamMessages (void) |
| Bool | isShift () |
| Bool | isCtrl () |
| Bool | isAlt () |
| Int | getModifierFlags () |
| void | resetKeys (void) |
| reset the state of the keys | |
| KeyboardIO * | getFirstKey (void) |
| get first key ready for processing | |
| void | setKeyStatusData (UnsignedByte key, KeyboardIO::StatusType data) |
| set key status | |
| WideChar | translateKey (WideChar keyCode) |
| translte key code to printable UNICODE char | |
| WideChar | getPrintableKey (UnsignedByte key, Int state) |
Public Member Functions inherited from SubsystemInterface | |
| SubsystemInterface () | |
| virtual | ~SubsystemInterface () |
| virtual void | postProcessLoad () |
| virtual void | draw (void) |
| void | UPDATE (void) |
| void | DRAW (void) |
| AsciiString | getName (void) |
| void | setName (AsciiString name) |
Protected Types | |
| enum | { NUM_KEYS = 256 } |
| enum | { KEY_NAMES_COUNT = 256 } |
Protected Member Functions | |
| virtual void | getKey (KeyboardIO *key)=0 |
| void | initKeyNames (void) |
| initialize the key names table | |
| void | updateKeys (void) |
| update the state of our key data | |
| Bool | checkKeyRepeat (void) |
| check for repeating keys | |
| UnsignedByte | getKeyStatusData (UnsignedByte key) |
| get key status | |
| Bool | getKeyStateBit (UnsignedByte key, Int bit) |
| get key state bit | |
| UnsignedInt | getKeySequenceData (UnsignedByte key) |
| get key sequence | |
| void | setKeyStateData (UnsignedByte key, UnsignedByte data) |
| get key state | |
Protected Attributes | ||
| UnsignedShort | m_modifiers | |
| UnsignedByte | m_shift2Key | |
| KeyboardIO | m_keys [NUM_KEYS] | |
| the keys | ||
| KeyboardIO | m_keyStatus [NUM_KEYS] | |
| the key status flags | ||
| struct { | ||
| WideChar stdKey | ||
| WideChar shifted | ||
| WideChar shifted2 | ||
| } | m_keyNames [KEY_NAMES_COUNT] | |
| UnsignedInt | m_inputFrame | |
| frame input was gathered on | ||
Protected Attributes inherited from SubsystemInterface | ||
| AsciiString | m_name | |
Keyboard singleton to interface with the keyboard
Definition at line 87 of file Keyboard.h.
| anonymous enum |
| Enumerator | |
|---|---|
| MAX_KEY_STATES | |
Definition at line 121 of file Keyboard.h.
|
protected |
| Enumerator | |
|---|---|
| KEY_NAMES_COUNT | |
Definition at line 154 of file Keyboard.h.
|
protected |
| Enumerator | |
|---|---|
| NUM_KEYS | |
Definition at line 150 of file Keyboard.h.
| Keyboard::Keyboard | ( | void | ) |
Definition at line 687 of file Keyboard.cpp.
|
virtual |
Definition at line 702 of file Keyboard.cpp.
|
protected |
check for repeating keys
check key repeat sequences, TRUE is returned if repeat is occurring
Definition at line 199 of file Keyboard.cpp.
|
virtual |
given state of device, create messages and put them on the stream for the raw state.
Given the state of the device, create messages from the input and place them on the message stream
Definition at line 50 of file Keyboard.cpp.
|
pure virtual |
get state of caps lock key, return TRUE if down
Implemented in DirectInputKeyboard.
| KeyboardIO * Keyboard::getFirstKey | ( | void | ) |
get first key ready for processing
get the first key in our current state of the keyboard
Definition at line 763 of file Keyboard.cpp.
|
protectedpure virtual |
get the key data for a single key, KEY_NONE should be returned when no key data is available to get anymore, you must implement this for your device
Implemented in DirectInputKeyboard.
|
protected |
get key sequence
return the sequence data for the given key
Definition at line 787 of file Keyboard.cpp.
|
protected |
get key state bit
Get the key state data as a Bool for the specified key
Definition at line 779 of file Keyboard.cpp.
|
protected |
get key status
return the key status for the specified key
Definition at line 771 of file Keyboard.cpp.
|
inline |
Definition at line 112 of file Keyboard.h.
| WideChar Keyboard::getPrintableKey | ( | UnsignedByte | key, |
| Int | state ) |
Definition at line 976 of file Keyboard.cpp.
|
virtual |
initialize the keyboard, only extend this functionality, do not replace
Initialzie the keyboard
Implements SubsystemInterface.
Reimplemented in DirectInputKeyboard.
Definition at line 710 of file Keyboard.cpp.
|
protected |
initialize the key names table
Initialize the keyboard key-names array
Definition at line 255 of file Keyboard.cpp.
| Bool Keyboard::isAlt | ( | ) |
returns true if any shift state is pressed
Definition at line 966 of file Keyboard.cpp.
| Bool Keyboard::isCtrl | ( | ) |
returns true if any control state is pressed
Definition at line 954 of file Keyboard.cpp.
| Bool Keyboard::isShift | ( | ) |
returns true if any shift state is pressed
Definition at line 942 of file Keyboard.cpp.
|
virtual |
Reset keyboard system.
Reset keyboard system
Implements SubsystemInterface.
Reimplemented in DirectInputKeyboard.
Definition at line 724 of file Keyboard.cpp.
| void Keyboard::resetKeys | ( | void | ) |
reset the state of the keys
Reset the state data for the keys, we likely want to do this when we once again gain focus to our app from something like an alt tab
Definition at line 747 of file Keyboard.cpp.
|
protected |
| void Keyboard::setKeyStatusData | ( | UnsignedByte | key, |
| KeyboardIO::StatusType | data ) |
translte key code to printable UNICODE char
This routine must be called with every character to properly monitor the shift state. Takes a keycode as input, and returns the UNICODE char representing the character.
Definition at line 814 of file Keyboard.cpp.
|
virtual |
gather current state of all keys, extend this functionality, do not replace
Called once per frame to gather key data input
Implements SubsystemInterface.
Reimplemented in DirectInputKeyboard.
Definition at line 732 of file Keyboard.cpp.
|
protected |
update the state of our key data
update all our key state data
Definition at line 101 of file Keyboard.cpp.
|
protected |
frame input was gathered on
Definition at line 163 of file Keyboard.h.
| struct { ... } Keyboard::m_keyNames[ KEY_NAMES_COUNT ] |
|
protected |
the keys
Definition at line 151 of file Keyboard.h.
|
protected |
the key status flags
Definition at line 152 of file Keyboard.h.
|
protected |
Definition at line 137 of file Keyboard.h.
|
protected |
Definition at line 148 of file Keyboard.h.
| WideChar Keyboard::shifted |
Definition at line 159 of file Keyboard.h.
| WideChar Keyboard::shifted2 |
Definition at line 160 of file Keyboard.h.
| WideChar Keyboard::stdKey |
Definition at line 158 of file Keyboard.h.