input_common: Add property to invert an axis button

This commit is contained in:
Narr the Reg 2023-05-05 17:11:53 -06:00
parent 94c16132ba
commit 53ec77c62c
6 changed files with 15 additions and 3 deletions

View file

@ -58,6 +58,8 @@ void InputEngine::SetHatButton(const PadIdentifier& identifier, int button, u8 v
}
void InputEngine::SetAxis(const PadIdentifier& identifier, int axis, f32 value) {
value /= 2.0f;
value -= 0.5f;
{
std::scoped_lock lock{mutex};
ControllerData& controller = controller_list.at(identifier);

View file

@ -939,6 +939,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice(
.threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f),
.offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f),
.inverted = params.Get("invert", "+") == "-",
.inverted_button = params.Get("inverted", false) != 0,
.toggle = params.Get("toggle", false) != 0,
};
input_engine->PreSetController(identifier);