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

Give access to the real time state of an input handler. More...

#include <GamePad.hpp>

Static Public Member Functions

static void init (InputHandler &_inputHandler)
 Initialize with an InputHandler. More...
 
static bool isKeyPressed (GameKey key)
 Check if a key is pressed. More...
 
static bool isKeyPressedOnce (GameKey key)
 Check if a key is pressed only one time. More...
 
static bool isKeyPressedWithDelay (GameKey key, u16 delay)
 Check if a key is pressed with delay. More...
 
static InputHandlergetInputHandler ()
 Get the current input handler. More...
 

Static Private Attributes

static InputHandlerinputHandler = nullptr
 Current input handler. More...
 

Detailed Description

Give access to the real time state of an input handler.

gk::GamePad provides an interface to the state of the keyboard.

See also
gk::InputHandler

Definition at line 25 of file GamePad.hpp.

Member Function Documentation

§ getInputHandler()

static InputHandler* gk::GamePad::getInputHandler ( )
inlinestatic

Get the current input handler.

Returns
The currently active gk::InputHandler
See also
init

Definition at line 78 of file GamePad.hpp.

§ init()

static void gk::GamePad::init ( InputHandler _inputHandler)
inlinestatic

Initialize with an InputHandler.

Parameters
_inputHandlerThe gk::InputHandler to be bound to the GamePad

This function has to be called at init in your gk::CoreApplication subclass, with your own gk::InputHandler

See also
getInputHandler

Definition at line 37 of file GamePad.hpp.

§ isKeyPressed()

bool gk::GamePad::isKeyPressed ( GameKey  key)
static

Check if a key is pressed.

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

Definition at line 20 of file GamePad.cpp.

§ isKeyPressedOnce()

bool gk::GamePad::isKeyPressedOnce ( GameKey  key)
static

Check if a key is pressed only one time.

Parameters
keyKey to check
Returns
True if the key is pressed, false otherwise or if true has already been returned once

Definition at line 24 of file GamePad.cpp.

§ isKeyPressedWithDelay()

bool gk::GamePad::isKeyPressedWithDelay ( GameKey  key,
u16  delay 
)
static

Check if a key is pressed with delay.

Parameters
keyKey to check
delayDelay between key presses (in milliseconds)
Returns
True if the key is pressed, false otherwise or if true has already been returned before <delay> ms

Definition at line 28 of file GamePad.cpp.

Member Data Documentation

§ inputHandler

InputHandler * gk::GamePad::inputHandler = nullptr
staticprivate

Current input handler.

Definition at line 84 of file GamePad.hpp.


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