GameKit
0.0.1a
C++ gamedev tools
|
#include <KeyboardHandler.hpp>
Public Member Functions | |
void | loadKeysFromFile (const std::string &filename) |
bool | isKeyPressed (GameKey key) |
Check if a key is pressed. More... | |
SDL_Keycode | getKeyCode (gk::GameKey key) |
std::string | getKeyName (gk::GameKey key) |
void | setKeycode (gk::GameKey key, SDL_Keycode keycode) |
![]() | |
virtual | ~InputHandler ()=default |
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 Attributes | |
std::map< GameKey, SDL_Scancode > | m_keys |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
void | addKey (GameKey key) |
Add a new key to this input handler. More... | |
Definition at line 24 of file KeyboardHandler.hpp.
|
inline |
Definition at line 30 of file KeyboardHandler.hpp.
|
inline |
Definition at line 31 of file KeyboardHandler.hpp.
|
virtual |
Check if a key is pressed.
key | Key to check |
Reimplemented from gk::InputHandler.
Definition at line 43 of file KeyboardHandler.cpp.
void gk::KeyboardHandler::loadKeysFromFile | ( | const std::string & | filename | ) |
Definition at line 21 of file KeyboardHandler.cpp.
|
inline |
Definition at line 32 of file KeyboardHandler.hpp.
|
protected |
Definition at line 35 of file KeyboardHandler.hpp.