Level H Engine
LevelHEngine
Core
InputManager.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
#include <unordered_map>
5
#include "../Maths/Vec2.h"
6
#include "
InputManagerDefs.h
"
7
11
class
InputManager
12
{
13
public
:
14
19
static
void
pollInputEvent
(SDL_Event& incomingEvent);
20
26
static
bool
isKeyPressed
(SDL_Keycode key);
27
33
static
bool
isKeyReleased
(SDL_Keycode key);
34
40
static
bool
isMouseButtonPressed
(uint8_t button);
41
47
static
bool
isMouseButtonReleased
(uint8_t button);
48
53
static
Vec2
getMousePos
();
54
58
static
void
updateInputManager
();
59
60
private
:
61
63
enum
state
64
{
65
PRESSED
,
66
RELEASED
,
67
NONE
68
};
69
71
static
Vec2
mousePos
;
73
static
std::unordered_map<SDL_Keycode, state>
keys
;
75
static
std::unordered_map<uint8_t, state>
mouseButtons
;
76
81
static
void
pollKeyEvent
(SDL_Event& incomingEvent);
82
87
static
void
pollMouseEvent
(SDL_Event& incomingEvent);
88
92
static
void
resetKeys
();
93
};
InputManager::getMousePos
static Vec2 getMousePos()
A static function to get the mouse position.
Definition:
InputManager.cpp:122
InputManager::isMouseButtonReleased
static bool isMouseButtonReleased(uint8_t button)
A static function to check if a specific mouse button is released.
Definition:
InputManager.cpp:113
InputManager::isMouseButtonPressed
static bool isMouseButtonPressed(uint8_t button)
A static function to check if a specific mouse button is pressed.
Definition:
InputManager.cpp:104
InputManager::state
state
An static enum for the state of the keys and buttons.
Definition:
InputManager.h:63
InputManager::pollKeyEvent
static void pollKeyEvent(SDL_Event &incomingEvent)
A static function to poll the key input events.
Definition:
InputManager.cpp:53
Vec2
Contains the Vec2 structure with functions and overloaded operators.
Definition:
Vec2.h:8
InputManager::keys
static std::unordered_map< SDL_Keycode, state > keys
An unordered map of keys.
Definition:
InputManager.h:73
InputManager::pollMouseEvent
static void pollMouseEvent(SDL_Event &incomingEvent)
A function to poll the mouse input events.
Definition:
InputManager.cpp:67
InputManager::pollInputEvent
static void pollInputEvent(SDL_Event &incomingEvent)
A static function to poll the input events.
Definition:
InputManager.cpp:36
InputManager::PRESSED
Definition:
InputManager.h:65
InputManager
Contains static variables and functions for use with input manager.
Definition:
InputManager.h:11
InputManager::RELEASED
Definition:
InputManager.h:66
InputManager::isKeyPressed
static bool isKeyPressed(SDL_Keycode key)
A static function to check if a specific key is pressed.
Definition:
InputManager.cpp:86
InputManager::isKeyReleased
static bool isKeyReleased(SDL_Keycode key)
A static function to check if a specific key is released.
Definition:
InputManager.cpp:95
InputManager::mousePos
static Vec2 mousePos
The mouse position.
Definition:
InputManager.h:71
InputManager::NONE
Definition:
InputManager.h:67
InputManager::updateInputManager
static void updateInputManager()
A static function to update the input manager.
Definition:
InputManager.cpp:135
InputManager::resetKeys
static void resetKeys()
A function to reset the states of the keys.
Definition:
InputManager.cpp:127
InputManagerDefs.h
InputManager::mouseButtons
static std::unordered_map< uint8_t, state > mouseButtons
An unordered map of mouse buttons.
Definition:
InputManager.h:75
Generated on Mon Nov 5 2018 12:22:14 for Level H Engine by
1.8.13