1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-10-31 20:04:32 +00:00

options menu in progress

This commit is contained in:
Cameron Taylor 2021-02-24 18:32:51 -05:00
parent 88c26f9ca4
commit f86dc69cde
7 changed files with 106 additions and 29 deletions

View file

@ -18,7 +18,7 @@
<!-- ____________________________ Window Settings ___________________________ -->
<!--These window settings apply to all targets-->
<window width="1280" height="720" fps="60" background="#000000" hardware="true" vsync="false" />
<window width="1280" height="720" fps="" background="#000000" hardware="true" vsync="false" />
<!--HTML5-specific-->
<window if="html5" resizable="true" />

View file

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 194 KiB

View file

@ -1,5 +1,6 @@
package;
import flixel.FlxSprite;
import flixel.FlxSubState;
class ControlsSubState extends FlxSubState
@ -7,5 +8,8 @@ class ControlsSubState extends FlxSubState
public function new()
{
super();
var bullshit = new FlxSprite().makeGraphic(100, 100);
add(bullshit);
}
}

View file

@ -23,7 +23,7 @@ class MainMenuState extends MusicBeatState
var menuItems:FlxTypedGroup<FlxSprite>;
#if !switch
var optionShit:Array<String> = ['story mode', 'freeplay', 'donate'];
var optionShit:Array<String> = ['story mode', 'freeplay', 'donate', 'options'];
#else
var optionShit:Array<String> = ['story mode', 'freeplay'];
#end
@ -174,6 +174,8 @@ class MainMenuState extends MusicBeatState
trace("Freeplay Menu Selected");
case 'options':
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
FlxG.switchState(new OptionsMenu());
}
});

6
source/Options.hx Normal file
View file

@ -0,0 +1,6 @@
package;
class Options
{
public static var masterVolume:Float = 1;
}

View file

@ -32,6 +32,7 @@ class OptionsMenu extends MusicBeatState
menuBG.antialiasing = true;
add(menuBG);
/*
grpControls = new FlxTypedGroup<Alphabet>();
add(grpControls);
@ -46,14 +47,18 @@ class OptionsMenu extends MusicBeatState
}
// DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !!
}
*/
super.create();
openSubState(new OptionsSubState());
}
override function update(elapsed:Float)
{
super.update(elapsed);
/*
if (controls.ACCEPT)
{
changeBinding();
@ -70,6 +75,7 @@ class OptionsMenu extends MusicBeatState
if (controls.DOWN_P)
changeSelection(1);
}
*/
}
function waitingInput():Void

View file

@ -1,11 +1,70 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
import flixel.util.FlxColor;
class OptionsSubState extends MusicBeatSubstate
{
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume'];
var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls'];
var selector:FlxSprite;
var curSelected:Int = 0;
var grpOptionsTexts:FlxTypedGroup<FlxText>;
public function new()
{
super();
grpOptionsTexts = new FlxTypedGroup<FlxText>();
add(grpOptionsTexts);
selector = new FlxSprite().makeGraphic(5, 5, FlxColor.RED);
add(selector);
for (i in 0...textMenuItems.length)
{
var optionText:FlxText = new FlxText(20, 20 + (i * 50), 0, textMenuItems[i], 32);
optionText.ID = i;
grpOptionsTexts.add(optionText);
}
}
override function update(elapsed:Float)
{
super.update(elapsed);
if (controls.UP_P)
curSelected -= 1;
if (controls.DOWN_P)
curSelected += 1;
if (curSelected < 0)
curSelected = textMenuItems.length - 1;
if (curSelected >= textMenuItems.length)
curSelected = 0;
grpOptionsTexts.forEach(function(txt:FlxText)
{
txt.color = FlxColor.WHITE;
if (txt.ID == curSelected)
txt.color = FlxColor.YELLOW;
});
if (controls.ACCEPT)
{
switch (textMenuItems[curSelected])
{
case "Controls":
FlxG.state.closeSubState();
FlxG.state.openSubState(new ControlsSubState());
}
}
}
}