Skip to content

Commit

Permalink
bro
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Nov 2, 2024
1 parent db35a5c commit f9412bf
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions source/options/ControlsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,57 @@ class ControlsSubState extends ExtendableSubState {
if (gamepadMode) {
var keyPressed:FlxGamepadInputID = gamepad.firstJustPressedID();
if (gamepad != null && keyPressed.toString() != FlxGamepadInputID.NONE) {
var index = Math.floor(curSelected / 2);
if (curSelected % 2 == 0) {
SaveData.settings.gamepadBinds[index][0] = keyPressed;
} else {
SaveData.settings.gamepadBinds[index][1] = keyPressed;
switch (curSelected) {
case 0:
SaveData.settings.gamepadBinds[0][0] = keyPressed;
case 1:
SaveData.settings.gamepadBinds[0][1] = keyPressed;
case 2:
SaveData.settings.gamepadBinds[1][0] = keyPressed;
case 3:
SaveData.settings.gamepadBinds[1][1] = keyPressed;
case 4:
SaveData.settings.gamepadBinds[2][0] = keyPressed;
case 5:
SaveData.settings.gamepadBinds[2][1] = keyPressed;
case 6:
SaveData.settings.gamepadBinds[3][0] = keyPressed;
case 7:
SaveData.settings.gamepadBinds[3][1] = keyPressed;
case 8:
SaveData.settings.gamepadBinds[4][0] = keyPressed;
case 9:
SaveData.settings.gamepadBinds[5][0] = keyPressed;
case 10:
SaveData.settings.gamepadBinds[6][0] = keyPressed;
}
}
} else {
var pressedKey = FlxG.keys.firstJustPressed();
if (pressedKey != -1) {
var index = Math.floor(curSelected / 2);
if (curSelected % 2 == 0) {
SaveData.settings.keyboardBinds[index][0] = pressedKey;
} else {
SaveData.settings.keyboardBinds[index][1] = pressedKey;
switch (curSelected) {
case 0:
SaveData.settings.keyboardBinds[0][0] = pressedKey;
case 1:
SaveData.settings.keyboardBinds[0][1] = pressedKey;
case 2:
SaveData.settings.keyboardBinds[1][0] = pressedKey;
case 3:
SaveData.settings.keyboardBinds[1][1] = pressedKey;
case 4:
SaveData.settings.keyboardBinds[2][0] = pressedKey;
case 5:
SaveData.settings.keyboardBinds[2][1] = pressedKey;
case 6:
SaveData.settings.keyboardBinds[3][0] = pressedKey;
case 7:
SaveData.settings.keyboardBinds[3][1] = pressedKey;
case 8:
SaveData.settings.keyboardBinds[4][0] = pressedKey;
case 9:
SaveData.settings.keyboardBinds[5][0] = pressedKey;
case 10:
SaveData.settings.keyboardBinds[6][0] = pressedKey;
}
}
}
Expand Down

0 comments on commit f9412bf

Please sign in to comment.