Carpenter Engine
A C++ game engine with a build once run anywhere solution
Loading...
Searching...
No Matches
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
15namespace Engine::Input {
16
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
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
A class used to handle inputs.
Definition InputManager.hpp:44
void Update()
Updates the input manager based on the input data available.
Definition InputManager.cpp:13
InputManager()
Default Constructor.
Definition InputManager.cpp:10
Input * GetInput(const char *name)
Returns the value of the input at the frame with the given name.
Definition InputManager.cpp:35
float GetAxis(const char *axis)
Returns the value of the axis at the frame with the given name.
Definition InputManager.cpp:24
void AddInput(const char *name, InputParams input)
Adds a single input to the input manager.
Definition InputManager.cpp:31
void AddAxis(const char *axis, InputParams positive, InputParams negative)
Adds an axis to the input manager.
Definition InputManager.cpp:20
A class used to represent a single input in an InputManager.
Definition Input.hpp:56
A struct used to hold the parameters of an input.
Definition Input.hpp:39