mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 13:05:45 -04:00
Support for SDL Joysticks
This enables use of non-controller peripherals, such as DirectInput steering wheels or flight sticks
This commit is contained in:
@ -128,16 +128,18 @@ void InputBindingDialog::addNewBinding(std::string new_binding)
|
||||
saveListToSettings();
|
||||
}
|
||||
|
||||
void InputBindingDialog::bindToControllerAxis(int controller_index, int axis_index, std::optional<bool> positive)
|
||||
void InputBindingDialog::bindToControllerAxis(int controller_index, int axis_index, bool inverted,
|
||||
std::optional<bool> half_axis_positive)
|
||||
{
|
||||
const char* invert_char = inverted ? "-" : "";
|
||||
const char* sign_char = "";
|
||||
if (positive)
|
||||
if (half_axis_positive)
|
||||
{
|
||||
sign_char = *positive ? "+" : "-";
|
||||
sign_char = *half_axis_positive ? "+" : "-";
|
||||
}
|
||||
|
||||
std::string binding =
|
||||
StringUtil::StdStringFromFormat("Controller%d/%sAxis%d", controller_index, sign_char, axis_index);
|
||||
StringUtil::StdStringFromFormat("Controller%d/%sAxis%d%s", controller_index, sign_char, axis_index, invert_char);
|
||||
addNewBinding(std::move(binding));
|
||||
stopListeningForInput();
|
||||
}
|
||||
@ -149,6 +151,14 @@ void InputBindingDialog::bindToControllerButton(int controller_index, int button
|
||||
stopListeningForInput();
|
||||
}
|
||||
|
||||
void InputBindingDialog::bindToControllerHat(int controller_index, int hat_index, const QString& hat_direction)
|
||||
{
|
||||
std::string binding = StringUtil::StdStringFromFormat("Controller%d/Hat%d %s", controller_index, hat_index,
|
||||
hat_direction.toLatin1().constData());
|
||||
addNewBinding(std::move(binding));
|
||||
stopListeningForInput();
|
||||
}
|
||||
|
||||
void InputBindingDialog::onAddBindingButtonClicked()
|
||||
{
|
||||
if (isListeningForInput())
|
||||
|
Reference in New Issue
Block a user