scopedvr-map-core/ui/panels/status_bar.gd
2026-11-01 19:31:33 +01:00

81 lines
3 KiB
GDScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends HBoxContainer
## Statusleiste (aus main.gd ausgezogen, Karte t_eaccbfed U1 — Logik
## unverändert): Hilfs-Meldungen + permanente Werkzeug-Anzeige +
## Symmetrie-Anzeige + Objekt-/Terrain-Zähler + FPS-Timer.
var main # core/ui/main.gd
var status_label: Label
var tool_label: Label # permanenter Werkzeugmodus + Flug-Hint
var sym_label: Label
var stats_objects: Label
var stats_terrain: Label
static func spec() -> Dictionary:
return {"titel": "Statuszeile", "gruppe": "status", "order": 0}
func setup(p_main) -> void:
main = p_main
# Eine Leiste ist EINE Zeile (VBox-Erbe stapelte alle Labels senkrecht →
# riesiger Balken, Befund 25.10.).
size_flags_vertical = Control.SIZE_SHRINK_END
size_flags_horizontal = Control.SIZE_EXPAND_FILL
func theme_color(cname: String) -> Color:
if main != null and main.theme != null and main.theme.has_color(cname, "Editor"):
return main.theme.get_color(cname, "Editor")
return get_theme_color(cname, "Editor")
func build() -> void:
add_theme_constant_override("separation", UIScale.px(16))
status_label = Label.new()
status_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
status_label.clip_text = true # langer Text darf das Layout NICHT sprengen
add_child(status_label)
# Karte 3/3 (t_11b5c25b): PERMANENTE Werkzeug-Anzeige — Sly sieht immer,
# in welchem Werkzeug er ist, plus Hint für den Flugmodus (Umschalt+F).
tool_label = Label.new()
# U7: Werkzeug-Farbe über Theme (Editor/colors/accent).
tool_label.add_theme_color_override("font_color",
theme_color("accent"))
# Karte t_297221b5: Statuszeilen-Labels egalisiert (min-size-Druck bei 1.5×)
tool_label.clip_text = true
tool_label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
add_child(tool_label)
# Symmetrie-Anzeige (Karte t_f5935023, M1): Sly sieht in der Statuszeile
# immer, ob/wie gespiegelt wird (Standard: Punkt).
sym_label = Label.new()
# U7: Symmetrie-Farbe über Theme (Editor/colors/accent).
sym_label.add_theme_color_override("font_color",
theme_color("accent"))
sym_label.clip_text = true
sym_label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
add_child(sym_label)
stats_objects = Label.new()
# U7: Nebentext-Farbe über Theme (Editor/colors/field).
stats_objects.add_theme_color_override("font_color",
theme_color("field"))
stats_objects.clip_text = true
stats_objects.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
add_child(stats_objects)
# Terrain-Anteil + Editor-FPS (Perf-Zähler, Karte t_9aba04f1)
stats_terrain = Label.new()
# U7: Nebentext-Farbe über Theme (Editor/colors/field).
stats_terrain.add_theme_color_override("font_color",
theme_color("field"))
stats_terrain.clip_text = true
stats_terrain.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
add_child(stats_terrain)
var fps_timer := Timer.new()
fps_timer.wait_time = 0.5
fps_timer.autostart = true
fps_timer.timeout.connect(main.call.bind("_refresh_stats"))
add_child(fps_timer)