GameKit  0.0.1a
C++ gamedev tools
Public Member Functions | Protected Attributes | List of all members
gk::KeyboardHandler Class Reference

#include <KeyboardHandler.hpp>

Inheritance diagram for gk::KeyboardHandler:
gk::InputHandler

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)
 
- Public Member Functions inherited from gk::InputHandler
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
 
- Protected Attributes inherited from gk::InputHandler
std::map< GameKey, bool > m_keysPressed
 Keys state. More...
 
std::map< GameKey, bool > m_keysPressedOnce
 Keys state for isKeyPressedOnce. More...
 
std::map< GameKey, u32m_lastTimePressed
 Keys state for isKeyPressedWithDelay. More...
 

Additional Inherited Members

- Protected Member Functions inherited from gk::InputHandler
void addKey (GameKey key)
 Add a new key to this input handler. More...
 

Detailed Description

Definition at line 24 of file KeyboardHandler.hpp.

Member Function Documentation

§ getKeyCode()

SDL_Keycode gk::KeyboardHandler::getKeyCode ( gk::GameKey  key)
inline

Definition at line 30 of file KeyboardHandler.hpp.

§ getKeyName()

std::string gk::KeyboardHandler::getKeyName ( gk::GameKey  key)
inline

Definition at line 31 of file KeyboardHandler.hpp.

§ isKeyPressed()

bool gk::KeyboardHandler::isKeyPressed ( GameKey  key)
virtual

Check if a key is pressed.

Parameters
keyKey to check
Returns
True if the key is pressed, false otherwise

Reimplemented from gk::InputHandler.

Definition at line 43 of file KeyboardHandler.cpp.

§ loadKeysFromFile()

void gk::KeyboardHandler::loadKeysFromFile ( const std::string &  filename)

Definition at line 21 of file KeyboardHandler.cpp.

§ setKeycode()

void gk::KeyboardHandler::setKeycode ( gk::GameKey  key,
SDL_Keycode  keycode 
)
inline

Definition at line 32 of file KeyboardHandler.hpp.

Member Data Documentation

§ m_keys

std::map<GameKey, SDL_Scancode> gk::KeyboardHandler::m_keys
protected

Definition at line 35 of file KeyboardHandler.hpp.


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