Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
src
engine
Input
InputManager.hpp
1
/*
2
* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
*/
6
7
#ifndef ENGINE_INPUTMANAGER
8
#define ENGINE_INPUTMANAGER
9
10
#include "Input.hpp"
11
#include <map>
12
13
#include <emscripten/html5.h>
14
15
namespace
Engine::Input {
16
44
class
InputManager
{
45
private
:
46
47
struct
Axis {
48
Input
* positive;
49
Input
* negative;
50
};
51
52
std::map<const char*, Axis> m_axes;
53
54
public
:
55
59
InputManager
();
60
64
void
Update
();
65
80
void
AddAxis
(
const
char
* axis,
InputParams
positive,
InputParams
negative);
81
87
float
GetAxis
(
const
char
* axis);
88
94
void
AddInput
(
const
char
* name,
InputParams
input);
95
101
Input
*
GetInput
(
const
char
* name);
102
};
103
}
104
105
#endif
Engine::Input::InputManager
A class used to handle inputs.
Definition
InputManager.hpp:44
Engine::Input::InputManager::Update
void Update()
Updates the input manager based on the input data available.
Definition
InputManager.cpp:13
Engine::Input::InputManager::InputManager
InputManager()
Default Constructor.
Definition
InputManager.cpp:10
Engine::Input::InputManager::GetInput
Input * GetInput(const char *name)
Returns the value of the input at the frame with the given name.
Definition
InputManager.cpp:35
Engine::Input::InputManager::GetAxis
float GetAxis(const char *axis)
Returns the value of the axis at the frame with the given name.
Definition
InputManager.cpp:24
Engine::Input::InputManager::AddInput
void AddInput(const char *name, InputParams input)
Adds a single input to the input manager.
Definition
InputManager.cpp:31
Engine::Input::InputManager::AddAxis
void AddAxis(const char *axis, InputParams positive, InputParams negative)
Adds an axis to the input manager.
Definition
InputManager.cpp:20
Engine::Input::Input
A class used to represent a single input in an InputManager.
Definition
Input.hpp:56
Engine::Input::InputParams
A struct used to hold the parameters of an input.
Definition
Input.hpp:39
Generated by
1.9.8