Public Member Functions | |
bool | CheckKeyState (int key) |
Checks key state. | |
void | ClearBuffer () |
Clears the key buffer. | |
void | PopState () |
Un-stacks the current state. | |
void | PushState () |
Stacks the current state. | |
void | SetKeyState (bool pressed, int key) |
Sets key state. | |
Static Public Member Functions | |
static Keyboard * | GetInstance (void) |
Gets an object for this class. |
Keyboard * e2d::core::Keyboard::GetInstance | ( | void | ) | [static] |
This class is a Singleton. If you want an instance of this class to work with, get it via this method.
bool e2d::core::Keyboard::CheckKeyState | ( | int | key | ) |
With this method you are able to verify if a key is being or not pressed on the keyboard.
key | The key you want to check the state of: see SDL documentation for key constants. |
void e2d::core::Keyboard::ClearBuffer | ( | ) |
Clears the key buffer by setting all key states to false.
void e2d::core::Keyboard::PopState | ( | ) |
Recovers the last pushed keyboard buffer state, or resets the buffer (with ClearBuffer()) if there was nothing on the stack.
void e2d::core::Keyboard::PushState | ( | ) |
Stores the current keyboard buffer state into an internal stack.
void e2d::core::Keyboard::SetKeyState | ( | bool | pressed, | |
int | key | |||
) |
With this method you can set a key state yourself. Note that if a key is not pressed and you set its state to pressed, it will remain in a state of pressed even if the key is not really being pressed on the keyboard. But, if the real key is pressed and then released, then it will switch to the state of unpressed.
pressed | Set it to true if you want the key to be seen as pressed, and set it to false otherwise. | |
key | The key you want to change the state: see SDL documentation for key constants. |