Unravel Engine C++ Reference
Loading...
Searching...
No Matches
gamepad_action_map.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "action_id.hpp"
4#include "axis_range.hpp"
5#include "gamepad.hpp"
6#include "gamepad_axis.hpp"
7#include "gamepad_button.hpp"
8#include "input_type.hpp"
9#include <map>
10#include <vector>
11
12namespace input
13{
15{
16public:
18 {
21 uint32_t value{};
24
25 friend auto operator==(const gamepad_entry& lhs, const gamepad_entry& rhs) -> bool = default;
26 };
27
28 std::map<action_id_t, std::vector<gamepad_entry>> entries_by_action_id_;
29
30 auto get_analog_value(const action_id_t& action, const gamepad& device) const -> float;
31 auto get_digital_value(const action_id_t& action, const gamepad& device) const -> bool;
32 auto is_pressed(const action_id_t& action, const gamepad& device) const -> bool;
33 auto is_released(const action_id_t& action, const gamepad& device) const -> bool;
34 auto is_down(const action_id_t& action, const gamepad& device) const -> bool;
35
36
37 void map(const action_id_t& action,
40 float min_analog_value = -1.0f,
41 float max_analog_value = 1.0f);
42 void map(const action_id_t& action, gamepad_button button);
43
44 friend auto operator==(const gamepad_action_map& lhs, const gamepad_action_map& rhs) -> bool = default;
45};
46} // namespace InputLib
auto get_digital_value(const action_id_t &action, const gamepad &device) const -> bool
auto is_down(const action_id_t &action, const gamepad &device) const -> bool
auto is_released(const action_id_t &action, const gamepad &device) const -> bool
auto is_pressed(const action_id_t &action, const gamepad &device) const -> bool
std::map< action_id_t, std::vector< gamepad_entry > > entries_by_action_id_
auto get_analog_value(const action_id_t &action, const gamepad &device) const -> float
void map(const action_id_t &action, gamepad_axis axis, axis_range range=axis_range::full, float min_analog_value=-1.0f, float max_analog_value=1.0f)
friend auto operator==(const gamepad_action_map &lhs, const gamepad_action_map &rhs) -> bool=default
std::string action_id_t
Definition action_id.hpp:6
input_type type
float max_analog_value
uint32_t value
friend auto operator==(const gamepad_entry &lhs, const gamepad_entry &rhs) -> bool=default
float min_analog_value