diff --git a/assets/preload/images/main_menu.png b/assets/preload/images/main_menu.png deleted file mode 100644 index 3241e45..0000000 Binary files a/assets/preload/images/main_menu.png and /dev/null differ diff --git a/assets/preload/images/main_menu.xml b/assets/preload/images/main_menu.xml deleted file mode 100644 index 9a57076..0000000 --- a/assets/preload/images/main_menu.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/preload/images/options/optionbg.png b/assets/preload/images/options/optionbg.png new file mode 100644 index 0000000..f10629b Binary files /dev/null and b/assets/preload/images/options/optionbg.png differ diff --git a/source/funkin/objects/ui/OptionItem.hx b/source/funkin/objects/ui/OptionItem.hx new file mode 100644 index 0000000..137f5d1 --- /dev/null +++ b/source/funkin/objects/ui/OptionItem.hx @@ -0,0 +1,26 @@ +package funkin.objects.ui; + +import flixel.group.FlxSpriteGroup; +import flixel.addons.display.FlxSliceSprite; +import flixel.math.FlxRect; + +class OptionItem extends FlxSpriteGroup { + var alphabet:Alphabet; + var background:FlxSliceSprite; + + public function new(x:Float, y:Float, text:String) { + super(x, y); + + alphabet = new Alphabet(0, 0, text, true); + background = new FlxSliceSprite(Paths.image('options/optionbg'), new FlxRect(37, 1, 1, 37), alphabet.width, 75); + + alphabet.x = this.x; + alphabet.y = this.y; + + background.x = alphabet.x - 20; + background.y = alphabet.y + 20; + + add(background); + add(alphabet); + } +} \ No newline at end of file diff --git a/source/funkin/states/options/Option.hx b/source/funkin/states/options/Option.hx new file mode 100644 index 0000000..695713e --- /dev/null +++ b/source/funkin/states/options/Option.hx @@ -0,0 +1,15 @@ +package funkin.states.options; + +class Option { + var name:String; + var description:String; + var variable:String; + var type:String; // String, Bool, Array, Dynamic + + public function new(name:String, description:String, variable:String, type:String) { + this.name = name; + this.description = description; + this.variable = variable; + this.type = type; + } +} \ No newline at end of file diff --git a/source/funkin/states/options/OptionsStateNew.hx b/source/funkin/states/options/OptionsStateNew.hx index f7502d3..a35bca0 100644 --- a/source/funkin/states/options/OptionsStateNew.hx +++ b/source/funkin/states/options/OptionsStateNew.hx @@ -1,9 +1,18 @@ package funkin.states.options; import flixel.addons.display.FlxBackdrop; +import funkin.objects.ui.OptionItem; + +class OptionsStateNew extends MusicBeatState { + var curSelected:Int = 0; + + var menuItems:FlxTypedGroup; + var optionsList:Array = [ + 'Gameplay', + 'Controls', + 'Graphics' + ]; -class OptionsStateNew extends MusicBeatState -{ override function create() { #if discord_rpc Discord.changePresence('Changing Preferences'); @@ -27,6 +36,19 @@ class OptionsStateNew extends MusicBeatState bfGrid.alpha = 0.4; add(bfGrid); + menuItems = new FlxTypedGroup(); + add(menuItems); + + var spacing:Float = 100; + for (i in 0...optionsList.length) { + var menuItem:Alphabet = new Alphabet(0, 100+(i*spacing), optionsList[i], true); + menuItem.screenCenter(X); + menuItem.ID = i; + menuItems.add(menuItem); + } + + changeSelection(0, false); + super.create(); } @@ -35,6 +57,35 @@ class OptionsStateNew extends MusicBeatState FlxG.switchState(new MainMenuState()); } + if (controls.UI_UP_P) { + changeSelection(-1); + } + + if (controls.UI_DOWN_P) { + changeSelection(1); + } + + for (item in menuItems) { + if (curSelected == item.ID) { + item.text = '>' + optionsList[item.ID] + '<'; + } else { + item.text = optionsList[item.ID]; + } + + item.screenCenter(X); + } + super.update(elapsed); } + + function changeSelection(change:Int = 0, playSound:Bool = true) { + if (playSound) FlxG.sound.play(Paths.sound('scrollMenu')); + + curSelected += change; + + if (curSelected < 0) + curSelected = menuItems.length - 1; + if (curSelected > menuItems.length - 1) + curSelected = 0; + } } \ No newline at end of file