8auto get_axis_value(
const float value,
10 const float min_analog_value,
11 const float max_analog_value) ->
float
21 v = value > 0.0f ? value : 0.0f;
24 v = value < 0.0f ? value : 0.0f;
31 const float in_start = -1.0f;
32 const float in_end = 1.0f;
34 return (
v - in_start) / (in_end - in_start) * (max_analog_value - min_analog_value) + min_analog_value;
40 const auto&
find = entries_by_action_id_.find(action);
42 if(
find == entries_by_action_id_.end())
47 const auto& entries =
find->second;
49 for(
const auto&
entry : entries)
55 const float value = get_axis_value(device.get_axis_value(
entry.value),
57 entry.min_analog_value,
58 entry.max_analog_value);
88 const auto&
find = entries_by_action_id_.find(action);
90 if(
find == entries_by_action_id_.end())
95 const auto& entries =
find->second;
97 for(
const auto&
entry : entries)
103 const float value = get_axis_value(device.get_axis_value(
entry.value),
105 entry.min_analog_value,
106 entry.max_analog_value);
136 const auto&
find = entries_by_action_id_.find(action);
138 if(
find == entries_by_action_id_.end())
143 const auto& entries =
find->second;
145 for(
const auto&
entry : entries)
171 const auto&
find = entries_by_action_id_.find(action);
173 if(
find == entries_by_action_id_.end())
178 const auto& entries =
find->second;
180 for(
const auto&
entry : entries)
206 const auto&
find = entries_by_action_id_.find(action);
208 if(
find == entries_by_action_id_.end())
213 const auto& entries =
find->second;
215 for(
const auto&
entry : entries)
244 float min_analog_value,
245 float max_analog_value)
250 entry.min_analog_value = min_analog_value;
251 entry.max_analog_value = max_analog_value;
252 entry.value =
static_cast<uint32_t
>(
axis);