Skip to content

Commit

Permalink
Made main menu shows the current keybind key for opening mods select …
Browse files Browse the repository at this point in the history
…menu (#271)

* Update Controls.hx

* done

* fixin a smol typo

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
  • Loading branch information
KarimAkra and NexIsDumb authored May 31, 2024
1 parent c38039c commit 1ac2e7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions source/funkin/backend/system/Controls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,18 @@ class Controls extends FlxActionSet
return byName[name].check();
}

public function getKeyName(control:Control):String
{
return getDialogueName(getActionFromControl(control));
}

public function getDialogueName(action:FlxActionDigital):String
{
var input = action.inputs[0];
return switch input.device
{
case KEYBOARD: return '[${(input.inputID : FlxKey)}]';
case GAMEPAD: return '(${(input.inputID : FlxGamepadInputID)})';
case KEYBOARD: return '${(input.inputID : FlxKey)}';
case GAMEPAD: return '${(input.inputID : FlxGamepadInputID)}';
case device: throw 'unhandled device: $device';
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/funkin/menus/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class MainMenuState extends MusicBeatState

FlxG.camera.follow(camFollow, null, 0.06);

var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[TAB] Open Mods menu\n');
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nCommit ${funkin.backend.system.macros.GitCommitMacro.commitNumber} (${funkin.backend.system.macros.GitCommitMacro.commitHash})\n[${controls.getKeyName(SWITCHMOD)}] Open Mods menu\n');
versionShit.y -= versionShit.height;
versionShit.scrollFactor.set();
add(versionShit);
Expand Down

0 comments on commit 1ac2e7f

Please sign in to comment.