Skip to content

Commit

Permalink
Add Remember Selection to MainMenuState
Browse files Browse the repository at this point in the history
  • Loading branch information
gamerbross committed May 18, 2024
1 parent 28bee83 commit bc1c15e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/funkin/ui/mainmenu/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class MainMenuState extends MusicBeatState
var magenta:FlxSprite;
var camFollow:FlxObject;

static var rememberedSelectedIndex:Int = 0;

override function create():Void
{
#if discord_rpc
Expand Down Expand Up @@ -137,6 +139,8 @@ class MainMenuState extends MusicBeatState
menuItem.scrollFactor.y = 0.4;
}

menuItems.selectItem(rememberedSelectedIndex);

resetCamStuff();

subStateOpened.add(sub -> {
Expand Down Expand Up @@ -285,6 +289,8 @@ class MainMenuState extends MusicBeatState
function startExitState(state:NextState):Void
{
menuItems.enabled = false; // disable for exit
rememberedSelectedIndex = menuItems.selectedIndex;

var duration = 0.4;
menuItems.forEach(function(item) {
if (menuItems.selectedIndex != item.ID)
Expand Down

0 comments on commit bc1c15e

Please sign in to comment.