Resolve pending gameplay tickets

This commit is contained in:
Loïc Wisniewski 2026-09-02 13:43:56 +02:00
commit c2ebbfaa2d
28 changed files with 618 additions and 188 deletions

View file

@ -25,7 +25,7 @@ extends Control
# with nothing to author, and building it here keeps MainMenu.tscn - which the
# player's own editor touches - out of the change.
const BACKDROP: Color = Color(0.01, 0.02, 0.06, 0.94)
const BACKDROP: Color = Color(0.01, 0.02, 0.06, 1.0)
const GLOW: Color = Color(0.42, 0.86, 0.95)
const TEXT: Color = Color(0.82, 0.94, 1.0)
const MUTED: Color = Color(0.52, 0.66, 0.76)
@ -33,7 +33,6 @@ const TITLE_SIZE: int = 44
const SUBTITLE_SIZE: int = 24
const BAR_WIDTH: float = 520.0
const BAR_HEIGHT: float = 16.0
const BAR_GAP: float = 46.0
# The travelling band inside the bar, and how much of the bar it covers.
const SWEEP_SECONDS: float = 1.2
const SWEEP_WIDTH: float = 0.22
@ -55,12 +54,22 @@ func _ready() -> void:
# MainMenu refuses a second press while a load is running anyway.
mouse_filter = Control.MOUSE_FILTER_IGNORE
set_anchors_preset(Control.PRESET_FULL_RECT)
_fit_viewport()
get_viewport().size_changed.connect(_fit_viewport)
title_label = _make_label("LOADING", TITLE_SIZE, TEXT)
subtitle_label = _make_label("", SUBTITLE_SIZE, MUTED)
resized.connect(_layout)
_layout()
# A Control parent would resolve full-rect anchors for us. This node sits
# directly under a CanvasLayer, so its first layout pass can otherwise be
# 0x0 - exactly the frame that is supposed to cover the menu before loading.
func _fit_viewport() -> void:
position = Vector2.ZERO
size = get_viewport_rect().size
func _make_label(text_value: String, font_size: int, colour: Color) -> Label:
var label := Label.new()
label.text = text_value
@ -83,16 +92,17 @@ func begin(what: String) -> void:
func _bar_rect() -> Rect2:
var width: float = minf(BAR_WIDTH, maxf(size.x - 120.0, 40.0))
return Rect2(Vector2((size.x - width) * 0.5, size.y * 0.5 + BAR_GAP),
return Rect2(Vector2((size.x - width) * 0.5, (size.y - BAR_HEIGHT) * 0.5),
Vector2(width, BAR_HEIGHT))
func _layout() -> void:
if title_label == null:
return
title_label.position = Vector2(0.0, size.y * 0.5 - float(TITLE_SIZE) * 1.4)
var bar: Rect2 = _bar_rect()
title_label.position = Vector2(0.0, bar.position.y - float(TITLE_SIZE) * 1.8)
title_label.size = Vector2(size.x, float(TITLE_SIZE) * 1.4)
subtitle_label.position = Vector2(0.0, size.y * 0.5)
subtitle_label.position = Vector2(0.0, bar.end.y + 18.0)
subtitle_label.size = Vector2(size.x, float(SUBTITLE_SIZE) * 1.6)
queue_redraw()