v0.1.0-alpha: first playable
20 rooms, Crumb board token, Home and Game screens only.
This commit is contained in:
commit
f4b4a773f3
113 files changed
+4167
No files matched your search
@@ -0,0 +1,68 @@
|
||||
class_name UI
|
||||
extends RefCounted
|
||||
|
||||
## Small helpers so the screens stay readable.
|
||||
## Every control is built in code for now; we can move to .tscn layouts later.
|
||||
|
||||
static func label(text: String, font_size: int, color: Color = Palette.INK) -> Label:
|
||||
var l := Label.new()
|
||||
l.text = text
|
||||
l.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
l.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
l.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
l.add_theme_font_size_override("font_size", font_size)
|
||||
l.add_theme_color_override("font_color", color)
|
||||
return l
|
||||
|
||||
|
||||
static func button(text: String, primary: bool = false, min_height: int = 58) -> Button:
|
||||
var b := Button.new()
|
||||
b.text = text
|
||||
b.custom_minimum_size = Vector2(0, min_height)
|
||||
b.add_theme_font_size_override("font_size", 22)
|
||||
b.add_theme_color_override("font_color", Palette.INK)
|
||||
b.add_theme_color_override("font_hover_color", Palette.INK)
|
||||
b.add_theme_color_override("font_pressed_color", Palette.INK)
|
||||
b.add_theme_color_override("font_focus_color", Palette.INK)
|
||||
b.add_theme_stylebox_override("normal", _button_style(Palette.GOLD if primary else Palette.PAPER))
|
||||
b.add_theme_stylebox_override("hover", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05)))
|
||||
b.add_theme_stylebox_override("pressed", _button_style((Palette.GOLD if primary else Palette.PAPER).darkened(0.07)))
|
||||
b.add_theme_stylebox_override("focus", _button_style((Palette.GOLD if primary else Palette.PAPER).lightened(0.05)))
|
||||
b.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
return b
|
||||
|
||||
|
||||
static func panel(color: Color = Palette.PAPER, radius: int = 28, margin: int = 24) -> PanelContainer:
|
||||
var p := PanelContainer.new()
|
||||
var s := StyleBoxFlat.new()
|
||||
s.bg_color = color
|
||||
s.corner_radius_top_left = radius
|
||||
s.corner_radius_top_right = radius
|
||||
s.corner_radius_bottom_left = radius
|
||||
s.corner_radius_bottom_right = radius
|
||||
s.content_margin_left = margin
|
||||
s.content_margin_right = margin
|
||||
s.content_margin_top = margin
|
||||
s.content_margin_bottom = margin
|
||||
s.shadow_color = Color(0.29, 0.20, 0.14, 0.12)
|
||||
s.shadow_size = 6
|
||||
s.shadow_offset = Vector2(0, 4)
|
||||
p.add_theme_stylebox_override("panel", s)
|
||||
return p
|
||||
|
||||
|
||||
static func _button_style(color: Color) -> StyleBoxFlat:
|
||||
var s := StyleBoxFlat.new()
|
||||
s.bg_color = color
|
||||
s.corner_radius_top_left = 18
|
||||
s.corner_radius_top_right = 18
|
||||
s.corner_radius_bottom_left = 18
|
||||
s.corner_radius_bottom_right = 18
|
||||
s.content_margin_left = 18
|
||||
s.content_margin_right = 18
|
||||
s.content_margin_top = 10
|
||||
s.content_margin_bottom = 10
|
||||
s.shadow_color = Color(0.29, 0.20, 0.14, 0.14)
|
||||
s.shadow_size = 4
|
||||
s.shadow_offset = Vector2(0, 3)
|
||||
return s
|
||||
Reference in new issue
Block a user