From 34cb7f9982ab6b26127dd439a8167ee2ecabccad Mon Sep 17 00:00:00 2001 From: George FunBook Date: Mon, 22 Mar 2021 08:40:32 -0500 Subject: [PATCH] more ui work --- source/MainMenuState.hx | 16 +++++++++------- source/PlayerSettings.hx | 15 +++------------ source/ui/ControlsMenu.hx | 5 +++-- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 0513d82a7..f2bc0f426 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -48,10 +48,10 @@ class MainMenuState extends MusicBeatState persistentUpdate = persistentDraw = true; - var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); + var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.18; - bg.setGraphicSize(Std.int(bg.width * 1.1)); + bg.setGraphicSize(Std.int(bg.width * 1.3)); bg.updateHitbox(); bg.screenCenter(); bg.antialiasing = true; @@ -60,12 +60,13 @@ class MainMenuState extends MusicBeatState camFollow = new FlxObject(0, 0, 1, 1); add(camFollow); - magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); - magenta.scrollFactor.x = 0; - magenta.scrollFactor.y = 0.18; - magenta.setGraphicSize(Std.int(magenta.width * 1.1)); + magenta = new FlxSprite(Paths.image('menuDesat')); + magenta.scrollFactor.x = bg.scrollFactor.x; + magenta.scrollFactor.y = bg.scrollFactor.y; + magenta.setGraphicSize(Std.int(bg.width)); magenta.updateHitbox(); - magenta.screenCenter(); + magenta.x = bg.x; + magenta.y = bg.y; magenta.visible = false; magenta.antialiasing = true; magenta.color = 0xFFfd719b; @@ -109,6 +110,7 @@ class MainMenuState extends MusicBeatState } FlxG.camera.follow(camFollow, null, 0.06); + FlxG.camera.setScrollBounds(bg.x, bg.x + bg.width, bg.y, bg.y + bg.height * 1.2); var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, "v" + Application.current.meta.get('version'), 12); versionShit.scrollFactor.set(); diff --git a/source/PlayerSettings.hx b/source/PlayerSettings.hx index b275b9b51..df7586c44 100644 --- a/source/PlayerSettings.hx +++ b/source/PlayerSettings.hx @@ -14,21 +14,12 @@ class PlayerSettings static public var player1(default, null):PlayerSettings; static public var player2(default, null):PlayerSettings; - #if (haxe >= "4.0.0") - static public final onAvatarAdd = new FlxTypedSignalVoid>(); - static public final onAvatarRemove = new FlxTypedSignalVoid>(); - #else - static public var onAvatarAdd = new FlxTypedSignalVoid>(); - static public var onAvatarRemove = new FlxTypedSignalVoid>(); - #end + static public var onAvatarAdd(default, null) = new FlxTypedSignalVoid>(); + static public var onAvatarRemove(default, null) = new FlxTypedSignalVoid>(); public var id(default, null):Int; - #if (haxe >= "4.0.0") - public final controls:Controls; - #else - public var controls:Controls; - #end + public var controls(default, null):Controls; // public var avatar:Player; // public var camera(get, never):PlayCamera; diff --git a/source/ui/ControlsMenu.hx b/source/ui/ControlsMenu.hx index cb471c2cf..ca923af29 100644 --- a/source/ui/ControlsMenu.hx +++ b/source/ui/ControlsMenu.hx @@ -65,7 +65,7 @@ class ControlsMenu extends ui.OptionsState.Page if (FlxG.gamepads.numActiveGamepads > 0) { var devicesBg = new FlxSprite(); - devicesBg.makeGraphic(FlxG.width, 100, 0xFF808080); + devicesBg.makeGraphic(FlxG.width, 100, 0xFFfafd6d); add(devicesBg); deviceList = new TextMenuList(Horizontal, None); add(deviceList); @@ -120,6 +120,7 @@ class ControlsMenu extends ui.OptionsState.Page { camFollow.y = deviceList.selectedItem.y; controlGrid.selectedItem.idle(); + controlGrid.enabled = false; } else camFollow.y = controlGrid.selectedItem.y; @@ -138,7 +139,7 @@ class ControlsMenu extends ui.OptionsState.Page prompt = new Prompt("\nPress any key to rebind\n\n\n\n Escape to cancel", None); prompt.create(); - prompt.createBgFromMargin(); + prompt.createBgFromMargin(100, 0xFFfafd6d); prompt.back.scrollFactor.set(0, 0); prompt.exists = false; add(prompt);