FIx customizable fontName

This commit is contained in:
Ralty
2026-04-01 19:51:11 +07:00
parent ca0853615b
commit b80c492afb
5 changed files with 14 additions and 5 deletions
@@ -6,14 +6,17 @@ import openfl.text.TextField;
class CodenameBuildField extends TextField {
public function new() {
super();
defaultTextFormat = Framerate.textFormat;
autoSize = LEFT;
multiline = wordWrap = false;
reload();
}
public function reload() {
#if COMPILE_EXPERIMENTAL
defaultTextFormat = Framerate.textFormat;
#if TEST_BUILD
text = '${Flags.VERSION_MESSAGE} (Test Build)';
#elseif COMPILE_EXPERIMENTAL
text = '${Flags.VERSION_MESSAGE} (Experimental Build)';
#else
text = '${Flags.VERSION_MESSAGE}';
@@ -76,6 +76,7 @@ class Framerate extends Sprite {
}
public function reload() {
textFormat = new TextFormat(fontName, 12, -1);
for(c in categories)
c.reload();
#if SHOW_BUILD_ON_FPS
@@ -40,7 +40,9 @@ class FramerateCategory extends Sprite {
this.text.y = this.title.y + this.title.height + 2;
}
public function reload() {}
public function reload() {
for(label in [this.title, this.text]) label.defaultTextFormat = new TextFormat(Framerate.fontName, label == this.title ? 18 : 12, -1);
}
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
@@ -35,6 +35,7 @@ class FramerateCounter extends Sprite {
}
public function reload() {
for (label in [fpsNum, fpsLabel]) label.defaultTextFormat = new TextFormat(Framerate.fontName, label == fpsNum ? 18 : 12, -1);
lastUpdateTime = 0;
}
@@ -23,14 +23,16 @@ class MemoryCounter extends Sprite {
label.y = 0;
label.text = "MEM";
label.multiline = label.wordWrap = false;
label.defaultTextFormat = new TextFormat(Framerate.fontName, 12, -1);
label.defaultTextFormat = Framerate.textFormat;
label.selectable = false;
addChild(label);
}
memoryPeakText.alpha = 0.5;
}
public function reload() {}
public function reload() {
for(label in [memoryText, memoryPeakText]) label.defaultTextFormat = Framerate.textFormat;
}
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;