From 9cfb707c85dea314313442a545d6b2f5f7a6855b Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:04:36 +0200 Subject: [PATCH 1/5] Update FramerateCounter.hx Remove the framerate count lerp --- source/funkin/backend/system/framerate/FramerateCounter.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/framerate/FramerateCounter.hx b/source/funkin/backend/system/framerate/FramerateCounter.hx index 55cc0f97..d1daae13 100644 --- a/source/funkin/backend/system/framerate/FramerateCounter.hx +++ b/source/funkin/backend/system/framerate/FramerateCounter.hx @@ -30,9 +30,9 @@ class FramerateCounter extends Sprite { if (alpha <= 0.05) return; super.__enterFrame(t); - lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed), 0.25); + lastFPS = FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed); fpsNum.text = Std.string(Math.floor(lastFPS)); fpsLabel.x = fpsNum.x + fpsNum.width; fpsLabel.y = (fpsNum.y + fpsNum.height) - fpsLabel.height; } -} \ No newline at end of file +} From 809ee452648a6a8ebfcbbfe305640078ac379363 Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:26:17 +0200 Subject: [PATCH 2/5] Add a setter for the text variable in the Alphabet class --- source/funkin/menus/ui/Alphabet.hx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index c885898e..50a8db46 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -23,7 +23,7 @@ class Alphabet extends FlxSpriteGroup public var targetY:Float = 0; public var isMenuItem:Bool = false; - public var text:String = ""; + public var text(default, set):String = ""; var _finalText:String = ""; var _curText:String = ""; @@ -51,6 +51,16 @@ class Alphabet extends FlxSpriteGroup return super.set_color(c); } + private function set_text(v:String):String { + text = v; + if (text != "") { + if (typed) + startTypedText(); + else + addText(); + } + } + // TODO: fix this shit refreshing public function refreshAlphabetXML(path:String) { AlphaCharacter.__alphaPath = path; @@ -84,7 +94,6 @@ class Alphabet extends FlxSpriteGroup { super(x, y); - _finalText = this.text = text; isBold = bold; var alphabetPath = Paths.xml("alphabet"); @@ -111,17 +120,7 @@ class Alphabet extends FlxSpriteGroup } #end - if (text != "") - { - if (typed) - { - startTypedText(); - } - else - { - addText(); - } - } + _finalText = this.text = text; } public function addText() From 8a3c763c6bc1f9ed7cb2782aadaf9ab3f87be84f Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:27:36 +0200 Subject: [PATCH 3/5] Revert "Update FramerateCounter.hx" --- source/funkin/backend/system/framerate/FramerateCounter.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/system/framerate/FramerateCounter.hx b/source/funkin/backend/system/framerate/FramerateCounter.hx index d1daae13..f5270051 100644 --- a/source/funkin/backend/system/framerate/FramerateCounter.hx +++ b/source/funkin/backend/system/framerate/FramerateCounter.hx @@ -30,7 +30,7 @@ class FramerateCounter extends Sprite { if (alpha <= 0.05) return; super.__enterFrame(t); - lastFPS = FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed); + lastFPS = CoolUtil.fpsLerp(lastFPS, FlxG.elapsed == 0 ? 0 : (1 / FlxG.elapsed), 0.25); fpsNum.text = Std.string(Math.floor(lastFPS)); fpsLabel.x = fpsNum.x + fpsNum.width; fpsLabel.y = (fpsNum.y + fpsNum.height) - fpsLabel.height; From e123fa06f7ae03c5d87ef6c32f883a6ce31c0cc3 Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:30:06 +0200 Subject: [PATCH 4/5] Update Alphabet.hx --- source/funkin/menus/ui/Alphabet.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index 50a8db46..fcc82a34 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -59,6 +59,7 @@ class Alphabet extends FlxSpriteGroup else addText(); } + return v; } // TODO: fix this shit refreshing From 280d14056e92086dc96d6d68d6691a87fd4a279e Mon Sep 17 00:00:00 2001 From: Sword352 <99792114+Sword352@users.noreply.github.com> Date: Tue, 4 Jul 2023 08:34:03 +0200 Subject: [PATCH 5/5] Destroy the characters before setting the new text --- source/funkin/menus/ui/Alphabet.hx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/funkin/menus/ui/Alphabet.hx b/source/funkin/menus/ui/Alphabet.hx index fcc82a34..f147d240 100644 --- a/source/funkin/menus/ui/Alphabet.hx +++ b/source/funkin/menus/ui/Alphabet.hx @@ -53,6 +53,13 @@ class Alphabet extends FlxSpriteGroup private function set_text(v:String):String { text = v; + + while (members.length > 0) { + var character = members[0]; + remove(character, true); + character.destroy(); + } + if (text != "") { if (typed) startTypedText();