1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 17:29:23 +01:00

fixed gamepad indices not being taken into account for directions in ui

This commit is contained in:
Ellpeck 2019-09-10 12:40:22 +02:00
parent c0a5f63c4d
commit 7e8da6d838

View file

@ -100,21 +100,21 @@ namespace MLEM.Ui {
}
// GAMEPAD INPUT
else if (this.GamepadButtons.Any(b => this.Input.IsGamepadButtonPressed(b, this.GamepadIndex))) {
else if (this.GamepadButtons.Any(this.IsGamepadPressed)) {
this.IsAutoNavMode = true;
if (this.SelectedElement?.Root != null)
this.SelectedElement.OnPressed?.Invoke(this.SelectedElement);
} else if (this.SecondaryGamepadButtons.Any(b => this.Input.IsGamepadButtonPressed(b, this.GamepadIndex))) {
} else if (this.SecondaryGamepadButtons.Any(this.IsGamepadPressed)) {
this.IsAutoNavMode = true;
if (this.SelectedElement?.Root != null)
this.SelectedElement.OnSecondaryPressed?.Invoke(this.SelectedElement);
} else if (this.Input.IsGamepadButtonPressed(Buttons.DPadDown) || this.Input.IsGamepadButtonPressed(Buttons.LeftThumbstickDown)) {
} else if (this.IsGamepadPressed(Buttons.DPadDown) || this.IsGamepadPressed(Buttons.LeftThumbstickDown)) {
this.HandleGamepadNextElement(Direction2.Down);
} else if (this.Input.IsGamepadButtonPressed(Buttons.DPadLeft) || this.Input.IsGamepadButtonPressed(Buttons.LeftThumbstickLeft)) {
} else if (this.IsGamepadPressed(Buttons.DPadLeft) || this.IsGamepadPressed(Buttons.LeftThumbstickLeft)) {
this.HandleGamepadNextElement(Direction2.Left);
} else if (this.Input.IsGamepadButtonPressed(Buttons.DPadRight) || this.Input.IsGamepadButtonPressed(Buttons.LeftThumbstickRight)) {
} else if (this.IsGamepadPressed(Buttons.DPadRight) || this.IsGamepadPressed(Buttons.LeftThumbstickRight)) {
this.HandleGamepadNextElement(Direction2.Right);
} else if (this.Input.IsGamepadButtonPressed(Buttons.DPadUp) || this.Input.IsGamepadButtonPressed(Buttons.LeftThumbstickUp)) {
} else if (this.IsGamepadPressed(Buttons.DPadUp) || this.IsGamepadPressed(Buttons.LeftThumbstickUp)) {
this.HandleGamepadNextElement(Direction2.Up);
}
}
@ -209,5 +209,9 @@ namespace MLEM.Ui {
}
}
private bool IsGamepadPressed(Buttons button) {
return this.Input.IsGamepadButtonPressed(button, this.GamepadIndex);
}
}
}