cubos::engine::InputCombination class final

Stores the keys, gamepad buttons, and mouse buttons of a single input combination.

Composed of multiple keys and buttons, and will be considered "pressed" if all of them are pressed.

Constructors, destructors, conversion operators

InputCombination() defaulted
Constructs without any keys or buttons.
InputCombination(std::vector<core::io::Key> keys, std::vector<core::io::GamepadButton> gamepadButtons = {}, std::vector<core::io::MouseButton> mouseButtons = {})
Constructs from sets of keys, gamepad buttons, and mouse buttons.

Public functions

auto keys() const -> const std::vector<core::io::Key>&
Gets the keys to be pressed.
auto keys() -> std::vector<core::io::Key>&
Gets the keys to be pressed.
auto gamepadButtons() const -> const std::vector<core::io::GamepadButton>&
Gets the gamepad buttons to be pressed.
auto gamepadButtons() -> std::vector<core::io::GamepadButton>&
Gets the gamepad buttons to be pressed.
auto mouseButtons() const -> const std::vector<core::io::MouseButton>&
Gets the mouse buttons to be pressed.
auto mouseButtons() -> std::vector<core::io::MouseButton>&
Gets the mouse buttons to be pressed.
auto pressed(const core::io::Window& window, const core::io::GamepadState* gamepad) const -> bool
Checks if the key combination is pressed.

Function documentation

cubos::engine::InputCombination::InputCombination(std::vector<core::io::Key> keys, std::vector<core::io::GamepadButton> gamepadButtons = {}, std::vector<core::io::MouseButton> mouseButtons = {})

Constructs from sets of keys, gamepad buttons, and mouse buttons.

Parameters
keys Keys to be pressed.
gamepadButtons Gamepad buttons to be pressed.
mouseButtons Mouse buttons to be pressed.

const std::vector<core::io::Key>& cubos::engine::InputCombination::keys() const

Gets the keys to be pressed.

Returns Vector of keys.

std::vector<core::io::Key>& cubos::engine::InputCombination::keys()

Gets the keys to be pressed.

Returns Vector of keys.

const std::vector<core::io::GamepadButton>& cubos::engine::InputCombination::gamepadButtons() const

Gets the gamepad buttons to be pressed.

Returns Vector of buttons.

std::vector<core::io::GamepadButton>& cubos::engine::InputCombination::gamepadButtons()

Gets the gamepad buttons to be pressed.

Returns Vector of buttons.

const std::vector<core::io::MouseButton>& cubos::engine::InputCombination::mouseButtons() const

Gets the mouse buttons to be pressed.

Returns Vector of buttons.

std::vector<core::io::MouseButton>& cubos::engine::InputCombination::mouseButtons()

Gets the mouse buttons to be pressed.

Returns Vector of buttons.

bool cubos::engine::InputCombination::pressed(const core::io::Window& window, const core::io::GamepadState* gamepad) const

Checks if the key combination is pressed.

Parameters
window Window to check for key and mouse button presses.
gamepad Gamepad to check for button presses.
Returns Whether the key combination is pressed