Carpenter Engine
A C++ game engine with a build once run anywhere solution
|
A class used to handle inputs. More...
#include <InputManager.hpp>
Public Member Functions | |
InputManager () | |
Default Constructor. | |
void | Update () |
Updates the input manager based on the input data available. | |
void | AddAxis (const char *axis, InputParams positive, InputParams negative) |
Adds an axis to the input manager. | |
float | GetAxis (const char *axis) |
Returns the value of the axis at the frame with the given name. | |
void | AddInput (const char *name, InputParams input) |
Adds a single input to the input manager. | |
Input * | GetInput (const char *name) |
Returns the value of the input at the frame with the given name. | |
A class used to handle inputs.
When creating an input manager, you can either create a button via the AddInput
function, or an axis via the AddAxis
function.
A Scene can have multiple InputManagers which can be used to organize inputs by object.
void Engine::Input::InputManager::AddAxis | ( | const char * | axis, |
InputParams | positive, | ||
InputParams | negative | ||
) |
Adds an axis to the input manager.
This can be accessed later using the GetAxis
function
axis | The name of the axis |
positive | The positive side of the axis (If down, axis = 1) |
negative | The negative side of the axis (If down, axis = -1) |
If both positive and negative are down, the axis will be set to 0 because the inputs will cancel out
void Engine::Input::InputManager::AddInput | ( | const char * | name, |
InputParams | input | ||
) |
Adds a single input to the input manager.
This can be accessed later using the GetInput
function
float Engine::Input::InputManager::GetAxis | ( | const char * | axis | ) |
Returns the value of the axis at the frame with the given name.
Engine::Input::Input * Engine::Input::InputManager::GetInput | ( | const char * | name | ) |
Returns the value of the input at the frame with the given name.