GameKit  0.0.1a
C++ gamedev tools
GamePad.hpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: GamePad.hpp
5  *
6  * Description:
7  *
8  * Created: 17/01/2018 19:11:54
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
14 #ifndef GK_GAMEPAD_HPP_
15 #define GK_GAMEPAD_HPP_
16 
18 
19 namespace gk {
20 
25 class GamePad {
26  public:
37  static void init(InputHandler &_inputHandler) { inputHandler = &_inputHandler; }
38 
47  static bool isKeyPressed(GameKey key);
48 
57  static bool isKeyPressedOnce(GameKey key);
58 
68  static bool isKeyPressedWithDelay(GameKey key, u16 delay);
69 
79 
80  private:
82  // Member data
85 };
86 
87 } // namespace gk
88 
89 #endif // GK_GAMEPAD_HPP_
90 
Give access to the real time state of an input device (keyboard, gamepad, etc...) ...
static bool isKeyPressed(GameKey key)
Check if a key is pressed.
Definition: GamePad.cpp:20
static bool isKeyPressedOnce(GameKey key)
Check if a key is pressed only one time.
Definition: GamePad.cpp:24
unsigned short u16
Definition: IntTypes.hpp:22
static void init(InputHandler &_inputHandler)
Initialize with an InputHandler.
Definition: GamePad.hpp:37
static bool isKeyPressedWithDelay(GameKey key, u16 delay)
Check if a key is pressed with delay.
Definition: GamePad.cpp:28
static InputHandler * inputHandler
Current input handler.
Definition: GamePad.hpp:84
u32 GameKey
Alias for game key type.
Give access to the real time state of an input handler.
Definition: GamePad.hpp:25
static InputHandler * getInputHandler()
Get the current input handler.
Definition: GamePad.hpp:78