GameKit
0.0.1a
C++ gamedev tools
|
Give access to the real time state of an input device (keyboard, gamepad, etc...) More...
#include <InputHandler.hpp>
Public Member Functions | |
virtual | ~InputHandler ()=default |
virtual bool | isKeyPressed (GameKey key) |
Check if a key is pressed. More... | |
virtual bool | isKeyPressedOnce (GameKey key) |
Check if a key is pressed only one time. More... | |
virtual bool | isKeyPressedWithDelay (GameKey key, u16 delay) |
Check if a key is pressed with delay. More... | |
const std::map< GameKey, bool > & | keysPressed () const |
Get current keys state. More... | |
Protected Member Functions | |
void | addKey (GameKey key) |
Add a new key to this input handler. More... | |
Protected Attributes | |
std::map< GameKey, bool > | m_keysPressed |
Keys state. More... | |
std::map< GameKey, bool > | m_keysPressedOnce |
Keys state for isKeyPressedOnce. More... | |
std::map< GameKey, u32 > | m_lastTimePressed |
Keys state for isKeyPressedWithDelay. More... | |
Give access to the real time state of an input device (keyboard, gamepad, etc...)
gk::InputHandler is a base class for your own input handler.
Definition at line 29 of file InputHandler.hpp.
|
virtualdefault |
|
protected |
Add a new key to this input handler.
The key you want to add
Definition at line 43 of file InputHandler.cpp.
|
inlinevirtual |
Check if a key is pressed.
key | Key to check |
Reimplemented in gk::KeyboardHandler.
Definition at line 41 of file InputHandler.hpp.
|
virtual |
Check if a key is pressed only one time.
key | Key to check |
Definition at line 19 of file InputHandler.cpp.
Check if a key is pressed with delay.
key | Key to check |
delay | Delay between key presses (in milliseconds) |
Definition at line 33 of file InputHandler.cpp.
|
inline |
Get current keys state.
Definition at line 70 of file InputHandler.hpp.
|
protected |
Keys state.
Definition at line 84 of file InputHandler.hpp.
|
protected |
Keys state for isKeyPressedOnce.
Definition at line 85 of file InputHandler.hpp.
Keys state for isKeyPressedWithDelay.
Definition at line 86 of file InputHandler.hpp.