feat: file-based config system + fix dashboard background rendering

This commit is contained in:
Eric Smith 2026-05-20 22:28:46 -04:00
parent c026c74af2
commit c6bc1edda4
7 changed files with 97 additions and 20 deletions

View file

@ -1,5 +1,5 @@
@tool
extends Control
extends PanelContainer
@onready var grid: DashboardGrid = %DashboardGrid
@ -8,16 +8,19 @@ var _modules: Array = []
func _ready() -> void:
if Engine.is_editor_hint():
_set_background()
return
_set_background()
_add_modules()
if not Engine.is_editor_hint():
_add_modules()
func _set_background() -> void:
var bg := StyleBoxFlat.new()
bg.bg_color = Color(0.08, 0.08, 0.12, 1.0)
var bg: StyleBoxFlat
if ConfigManager.has_method("get_color"):
bg = StyleBoxFlat.new()
bg.bg_color = ConfigManager.get_color("background_color", Color(0.08, 0.08, 0.12))
else:
bg = StyleBoxFlat.new()
bg.bg_color = Color(0.08, 0.08, 0.12)
add_theme_stylebox_override("panel", bg)

View file

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://scripts/dashboard_grid.gd" id="2"]
[ext_resource type="Theme" path="res://themes/default_theme.tres" id="3"]
[node name="Dashboard" type="Control"]
[node name="Dashboard" type="PanelContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0

View file

@ -1,6 +1,7 @@
extends Control
@onready var bg: ColorRect = %Bg
@onready var v_label: Label = %VLabel
@onready var panel_label: Label = %PanelLabel
@onready var transition_overlay: ColorRect = %TransitionOverlay
@ -20,6 +21,10 @@ func _ready() -> void:
var screen_size: Vector2 = get_viewport_rect().size
# Background color from config
if ConfigManager.has_method("get_color"):
bg.color = ConfigManager.get_color("background_color", Color(0.08, 0.08, 0.12))
# Compute end font sizes as a large fraction of screen height.
# Use set() to go through the property system directly.
_v_end = maxi(1, int(screen_size.y * 0.28))

View file

@ -24,6 +24,7 @@ theme = ExtResource("3")
script = ExtResource("1")
[node name="Bg" type="ColorRect" parent="."]
unique_name_in_owner = true
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0