From 2bd5e3ba47a120264f853a187d389bce57579983 Mon Sep 17 00:00:00 2001 From: Yoshman29 Date: Tue, 1 Nov 2022 01:37:32 +0100 Subject: [PATCH] imma try smth for the settings menu --- buildnumber.txt | 2 +- source/funkin/options/Options.hx | 10 ++++++++- source/funkin/options/OptionsMenu.hx | 1 + source/funkin/options/OptionsScreen.hx | 22 ++++++++++++++++--- .../options/categories/GameplayOptions.hx | 1 + 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 3cdc9881..523780a1 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -889 \ No newline at end of file +894 \ No newline at end of file diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index 1a960bd7..6cf0d14d 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -1,5 +1,6 @@ package funkin.options; +import flixel.FlxG; import funkin.system.Controls; import openfl.Lib; import flixel.util.FlxSave; @@ -11,7 +12,7 @@ class Options @:dox(hide) private static var __eventAdded = false; /** - * GAMEPLAY SETTINGS + * SETTINGS */ public static var naughtyness:Bool = true; public static var downscroll:Bool = false; @@ -19,6 +20,7 @@ class Options public static var camZoomOnBeat:Bool = true; public static var fpsCounter:Bool = true; public static var autoPause:Bool = true; + public static var antialiasing:Bool = true; /** * PLAYER 1 CONTROLS @@ -158,7 +160,13 @@ class Options }); __eventAdded = true; } + applySettings(); + } + + public static function applySettings() { PlayerSettings.player1.setKeyboardScheme(Solo); + FlxG.forceNoAntialiasing = !antialiasing; + FlxG.autoPause = autoPause; } public static function save() { diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index 24c123bb..77ca5b75 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -76,6 +76,7 @@ class OptionsMenu extends MusicBeatState { changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); if (controls.ACCEPT && alphabets.members[curSelected] != null) { CoolUtil.playMenuSFX(1); + canSelect = false; FlxFlicker.flicker(alphabets.members[curSelected], 1, 0.06, false, false, function(flick:FlxFlicker) { FlxTransitionableState.skipNextTransOut = true; diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx index 8be076c8..d6f51325 100644 --- a/source/funkin/options/OptionsScreen.hx +++ b/source/funkin/options/OptionsScreen.hx @@ -1,7 +1,9 @@ package funkin.options; import flixel.math.FlxMath; +import flixel.math.FlxPoint; import flixel.util.FlxColor; +import flixel.addons.transition.FlxTransitionableState; import flixel.FlxSprite; import flixel.FlxG; import funkin.options.type.OptionType; @@ -25,6 +27,7 @@ class OptionsScreen extends MusicBeatState { } public override function create() { + FlxTransitionableState.skipNextTransIn = true; super.create(); bg = new FlxSprite(-80).loadGraphic(Paths.image('menus/menuBG')); @@ -36,20 +39,32 @@ class OptionsScreen extends MusicBeatState { add(bg); for(k=>option in options) { - option.setPosition(0, 10 + (k * 120)); + option.setPosition(k * 20, 10 + (k * 120)); add(option); } changeSelection(1); } + public var scrollDest:FlxPoint = FlxPoint.get(0, 0); public override function update(elapsed:Float) { super.update(elapsed); changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0)); if (controls.ACCEPT) { options[curSelected].onSelect(); } - if (controls.BACK) - FlxG.switchState(new OptionsMenu(false)); + if (controls.BACK) { + Options.applySettings(); + exit(); + } + FlxG.camera.scroll.x = lerp(FlxG.camera.scroll.x, scrollDest.x, 0.25); + FlxG.camera.scroll.y = lerp(FlxG.camera.scroll.y, scrollDest.y, 0.25); + } + + public function exit() { + + FlxTransitionableState.skipNextTransOut = true; + FlxTransitionableState.skipNextTransIn = true; + FlxG.switchState(new OptionsMenu(false)); } public function changeSelection(change:Int) { @@ -59,6 +74,7 @@ class OptionsScreen extends MusicBeatState { e.selected = false; options[curSelected].selected = true; CoolUtil.playMenuSFX(0); + scrollDest.set(-50 + ((curSelected-2) * 20), -(FlxG.height / 2) + ((curSelected + 0.5) * 120)); } public override function destroy() { diff --git a/source/funkin/options/categories/GameplayOptions.hx b/source/funkin/options/categories/GameplayOptions.hx index 323ff46d..761c5250 100644 --- a/source/funkin/options/categories/GameplayOptions.hx +++ b/source/funkin/options/categories/GameplayOptions.hx @@ -5,6 +5,7 @@ class GameplayOptions extends OptionsScreen { options = [ new Checkbox("Downscroll", "downscroll"), new Checkbox("Auto Pause", "autoPause"), + new Checkbox("Antialiasing", "antialiasing"), ]; super.create(); }