cubos::engine::InputAxis class final

Stores the state of a single input axis, such as "move forward" or "move right".

Can be bound to multiple keys, and will have a value in the range [-1, 1] based on the the state of its bindings.

Constructors, destructors, conversion operators

InputAxis() defaulted
Constructs without any bindings.
InputAxis(std::vector<InputCombination> positive, std::vector<InputCombination> negative, std::vector<core::io::GamepadAxis> gamepadAxes)
Constructs with existing bindings.

Public functions

auto positive() const -> const std::vector<InputCombination>&
Gets the positive input combinations.
auto negative() const -> const std::vector<InputCombination>&
Gets the negative input combinations.
auto gamepadAxes() const -> const std::vector<core::io::GamepadAxis>&
Gets the gamepad axis bindings.
auto positive() -> std::vector<InputCombination>&
Gets the positive input combinations.
auto negative() -> std::vector<InputCombination>&
Gets the negative input combinations.
auto gamepadAxes() -> std::vector<core::io::GamepadAxis>&
Gets the gamepad axis bindings.
auto value() const -> float
Gets the value.
void value(float value)
Sets the value.

Function documentation

cubos::engine::InputAxis::InputAxis(std::vector<InputCombination> positive, std::vector<InputCombination> negative, std::vector<core::io::GamepadAxis> gamepadAxes)

Constructs with existing bindings.

Parameters
positive Positive input combinations.
negative Negative input combinations.
gamepadAxes Gamepad axis bindings.

const std::vector<InputCombination>& cubos::engine::InputAxis::positive() const

Gets the positive input combinations.

Returns Vector of positive input combinations.

const std::vector<InputCombination>& cubos::engine::InputAxis::negative() const

Gets the negative input combinations.

Returns Vector of negative input combinations.

const std::vector<core::io::GamepadAxis>& cubos::engine::InputAxis::gamepadAxes() const

Gets the gamepad axis bindings.

Returns Vector of gamepad axes.

std::vector<InputCombination>& cubos::engine::InputAxis::positive()

Gets the positive input combinations.

Returns Vector of positive input combinations.

std::vector<InputCombination>& cubos::engine::InputAxis::negative()

Gets the negative input combinations.

Returns Vector of negative input combinations.

std::vector<core::io::GamepadAxis>& cubos::engine::InputAxis::gamepadAxes()

Gets the gamepad axis bindings.

Returns Vector of gamepad axes.

float cubos::engine::InputAxis::value() const

Gets the value.

Returns Value.

void cubos::engine::InputAxis::value(float value)

Sets the value.

Parameters
value New value.