mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
FullscreenUI: Support binding half axes
This commit is contained in:
parent
f861fa40e5
commit
0d86d85752
|
@ -150,6 +150,7 @@ enum class InputBindingType
|
|||
None,
|
||||
Button,
|
||||
Axis,
|
||||
HalfAxis,
|
||||
Rumble
|
||||
};
|
||||
|
||||
|
@ -886,6 +887,9 @@ static void DrawInputBindingButton(InputBindingType type, const char* section, c
|
|||
case InputBindingType::Axis:
|
||||
title.Format(ICON_FA_BULLSEYE " %s Axis", display_name);
|
||||
break;
|
||||
case InputBindingType::HalfAxis:
|
||||
title.Format(ICON_FA_SLIDERS_H " %s Half-Axis", display_name);
|
||||
break;
|
||||
case InputBindingType::Rumble:
|
||||
title.Format(ICON_FA_BELL " %s", display_name);
|
||||
break;
|
||||
|
@ -980,6 +984,16 @@ void BeginInputBinding(InputBindingType type, const std::string_view& section, c
|
|||
}
|
||||
break;
|
||||
|
||||
case InputBindingType::HalfAxis:
|
||||
{
|
||||
if (hook.type == ControllerInterface::Hook::Type::Axis)
|
||||
{
|
||||
value.Format("Controller%d/%cAxis%d", hook.controller_index,
|
||||
(std::get<float>(hook.value) < 0.0f) ? '-' : '+', hook.button_or_axis_number);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case InputBindingType::Button:
|
||||
{
|
||||
if (hook.type == ControllerInterface::Hook::Type::Axis)
|
||||
|
@ -1887,7 +1901,9 @@ void DrawSettingsWindow()
|
|||
for (const auto& it : axis_cache[port])
|
||||
{
|
||||
key.Format("Axis%s", std::get<0>(it).c_str());
|
||||
DrawInputBindingButton(InputBindingType::Axis, section, key, std::get<0>(it).c_str());
|
||||
DrawInputBindingButton(std::get<2>(it) == Controller::AxisType::Half ? InputBindingType::HalfAxis :
|
||||
InputBindingType::Axis,
|
||||
section, key, std::get<0>(it).c_str());
|
||||
}
|
||||
|
||||
if (Controller::GetVibrationMotorCount(ctype) > 0)
|
||||
|
|
Loading…
Reference in a new issue