UI and other changes

This commit is contained in:
Forrest 2026-10-07 13:41:38 -04:00
parent 87b5c11fcf
commit 215e24e246
79 changed files with 70023 additions and 2201 deletions

View file

@ -5,11 +5,74 @@ extends RefCounted
## dark straw-trimmed panels, buttons that light up gold on hover and show a thick gold ring
## when focused (keyboard and gamepad players always see where they are), sliders, check
## boxes, and tabs to match. Labels keep the default look; the HUD sets its own sizes.
## sketch() is the hand-drawn theme the in-game panels use instead (the pause menu and its
## questions, the workbench and shed shops), to match the HUD's pouch panel (Sketch).
const TEXT := Color(0.95, 0.93, 0.85)
const GOLD := Color(0.95, 0.82, 0.45)
const DIM := Color(0.5, 0.5, 0.45)
static var _sketch: Theme
## The hand-drawn theme (Sketch, SketchBox), set as a panel's theme: the handwritten font with a
## dark outline on every label and button; panels in the pouch panel's dark wash and sketched ink
## frame; buttons as hotbar slots that light up on hover, with the hotbar's gold frame when
## focused; HSeparators as a pen rule; and SolidPanel, a PanelContainer variation without the
## see-through wash. Anything it leaves out (sliders, check boxes) falls back
## to the project's theme.
static func sketch() -> Theme:
if _sketch != null:
return _sketch
var t := Theme.new()
t.default_font = Sketch.font()
t.default_font_size = 28
var panel := SketchBox.new(Sketch.PANEL, Sketch.INK, Sketch.PANEL_INK)
_margins(panel, 26.0, 20.0)
t.set_stylebox("panel", "PanelContainer", panel)
t.set_stylebox("panel", "Panel", panel)
# The same panel without the see-through wash, for a question over another panel.
var solid := SketchBox.new(Color(Sketch.PANEL, 1.0), Sketch.INK, Sketch.PANEL_INK)
_margins(solid, 26.0, 20.0)
t.set_type_variation(&"SolidPanel", &"PanelContainer")
t.set_stylebox("panel", "SolidPanel", solid)
t.set_color("font_color", "Label", Sketch.TEXT)
t.set_color("font_outline_color", "Label", Sketch.INK)
t.set_constant("outline_size", "Label", 6)
var hover := Color(Sketch.SLOT.lightened(0.12), 0.8)
var styles := {
"normal": SketchBox.new(Sketch.SLOT, Sketch.INK, 2.5),
"hover": SketchBox.new(hover, Sketch.INK, 2.5),
"pressed": SketchBox.new(Color(Sketch.SLOT.darkened(0.3), 0.8), Sketch.GOLD, 2.5),
"disabled": SketchBox.new(Color(0.12, 0.12, 0.11, 0.5), Color(Sketch.INK, 0.6), 2.0),
"focus": SketchBox.new(Color(0, 0, 0, 0), Sketch.GOLD, 3.5),
}
for key: String in styles:
var b: SketchBox = styles[key]
_margins(b, 18.0, 6.0)
if key == "focus":
b.grow = 3.0
t.set_stylebox(key, "Button", b)
t.set_color("font_color", "Button", Sketch.TEXT)
t.set_color("font_hover_color", "Button", Color(1.0, 0.95, 0.7))
t.set_color("font_focus_color", "Button", Color(1.0, 0.95, 0.7))
t.set_color("font_hover_pressed_color", "Button", Sketch.GOLD)
t.set_color("font_pressed_color", "Button", Sketch.GOLD)
t.set_color("font_disabled_color", "Button", Sketch.DIM)
t.set_color("font_outline_color", "Button", Sketch.INK)
t.set_constant("outline_size", "Button", 6)
t.set_stylebox("separator", "HSeparator", SketchBox.new(Color(0, 0, 0, 0), Sketch.RULE, 2.0, true))
t.set_constant("separation", "HSeparator", 12)
_sketch = t
return t
static func _margins(s: StyleBox, x: float, y: float) -> void:
s.content_margin_left = x
s.content_margin_right = x
s.content_margin_top = y
s.content_margin_bottom = y
static func build() -> Theme:
var t := Theme.new()