fonts can now have custom variations via jsons

This commit is contained in:
JHDev2006
2025-10-16 22:46:02 +01:00
parent 823b6274f8
commit 44e7da3fea
7 changed files with 42 additions and 23 deletions

View File

@@ -3,8 +3,7 @@ extends Node
@export var labels: Array[Label]
const SMB1 = preload("uid://bl7sbw4nx3l1t")
const SMBLL = preload("uid://djxdgxy1iv8yv")
const MAIN_FONT = preload("uid://bl7sbw4nx3l1t")
const SCORE_FONT = preload("uid://bk0no5p6sifgu")
@export var use_score_font := false
@@ -16,18 +15,11 @@ func _ready() -> void:
Global.level_theme_changed.connect(refresh_font)
func refresh_font() -> void:
if Global.current_campaign == "SMBLL":
current_font = SMBLL
else:
current_font = SMB1
update_labels()
func update_labels() -> void:
var font_to_use = current_font
if use_score_font:
font_to_use = SCORE_FONT
for i in labels:
if i == null:
continue
i.remove_theme_font_override("font")
i.add_theme_font_override("font", font_to_use)
i.add_theme_font_override("font", MAIN_FONT)