From 91390b4d8bcb83fe40bd0364778d0b8d21020926 Mon Sep 17 00:00:00 2001 From: lunarcleint <88809950+lunarcleint@users.noreply.github.com> Date: Sat, 7 Oct 2023 18:18:34 -0700 Subject: [PATCH] optimized text outlines (idk if we gonna keep it) --- source/funkin/editors/ui/UISlider.hx | 2 +- source/funkin/editors/ui/UIText.hx | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 134df9d7..d86508c5 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -39,7 +39,7 @@ class UISlider extends UISprite { progressbar = new UISprite(centered ? barWidth/2 : 0); progressbar.makeGraphic(barWidth, 8, 0x00000000, true); - progressbar.drawRoundRect(2, 0, barWidth-4, 8-.1, 8, 2, 0xFF67009B); + progressbar.drawRoundRect(2, 0, barWidth-4, 8, 8, 2, 0xFF67009B); progressbar.origin.x = 0; members.push(progressbar); diff --git a/source/funkin/editors/ui/UIText.hx b/source/funkin/editors/ui/UIText.hx index 5f2aaf72..dc5b5535 100644 --- a/source/funkin/editors/ui/UIText.hx +++ b/source/funkin/editors/ui/UIText.hx @@ -16,4 +16,29 @@ class UIText extends FunkinText { } this.active = false; } + + public override function applyBorderStyle() { + if (borderStyle == OUTLINE_FAST) { + var iterations:Int = Std.int(borderSize * borderQuality); + if (iterations <= 0) + { + iterations = 1; + } + var delta:Float = borderSize / iterations; + + applyFormats(_formatAdjusted, true); + + var curDelta:Float = delta; + for (i in 0...iterations) + { + copyTextWithOffset(-curDelta, -curDelta); // upper-left + copyTextWithOffset(curDelta * 2, curDelta * 2); // lower-right + + _matrix.translate(-curDelta, -curDelta); // return to center + curDelta += delta; + } + return; + } + super.applyBorderStyle(); + } } \ No newline at end of file