- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.1 KiB
GDScript
56 lines
2.1 KiB
GDScript
class_name MenuIcons
|
||
extends RefCounted
|
||
## Small line icons drawn in code (no image files), for the main menu and the
|
||
## palettes. Each paints into a 24×24 box scaled to `size`.
|
||
|
||
const SHEET := "sheet"
|
||
const SPREAD := "spread"
|
||
const SETTINGS := "settings"
|
||
const QUIT := "quit"
|
||
const SEARCH := "search"
|
||
|
||
|
||
## A Control that draws icon `kind` in `color`, `size` pixels square.
|
||
static func make(kind: String, color: Color, size: float = 24.0) -> Control:
|
||
var c := Control.new()
|
||
c.custom_minimum_size = Vector2(size, size)
|
||
c.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||
c.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||
c.draw.connect(func() -> void: paint(c, kind, color, size / 24.0))
|
||
return c
|
||
|
||
|
||
static func paint(c: CanvasItem, kind: String, color: Color, k: float) -> void:
|
||
var w := 2.0 * k
|
||
var line := func(a: Vector2, b: Vector2) -> void: c.draw_line(a * k, b * k, color, w, true)
|
||
var rect := func(r: Rect2) -> void: c.draw_rect(Rect2(r.position * k, r.size * k), color, false, w, true)
|
||
match kind:
|
||
SHEET:
|
||
rect.call(Rect2(4, 3, 16, 18))
|
||
line.call(Vector2(8, 8), Vector2(16, 8))
|
||
line.call(Vector2(8, 12), Vector2(11, 12))
|
||
line.call(Vector2(13, 12), Vector2(16, 12))
|
||
line.call(Vector2(8, 16), Vector2(16, 16))
|
||
SPREAD:
|
||
rect.call(Rect2(3, 4, 7, 9))
|
||
rect.call(Rect2(14, 11, 7, 9))
|
||
var pts := PackedVector2Array()
|
||
for i in 9:
|
||
var t := i / 8.0
|
||
pts.append(Vector2(10 + 4 * t, 8 + 6 * t * t) * k)
|
||
c.draw_polyline(pts, color, w, true)
|
||
SETTINGS:
|
||
c.draw_arc(Vector2(12, 12) * k, 3.0 * k, 0.0, TAU, 20, color, w, true)
|
||
for i in 8:
|
||
var dir := Vector2.RIGHT.rotated(i * TAU / 8.0)
|
||
line.call(Vector2(12, 12) + dir * 6.5, Vector2(12, 12) + dir * 9.5)
|
||
QUIT:
|
||
line.call(Vector2(15, 4), Vector2(19, 4))
|
||
line.call(Vector2(19, 4), Vector2(19, 20))
|
||
line.call(Vector2(19, 20), Vector2(15, 20))
|
||
line.call(Vector2(6, 12), Vector2(16, 12))
|
||
line.call(Vector2(10, 8), Vector2(6, 12))
|
||
line.call(Vector2(10, 16), Vector2(6, 12))
|
||
SEARCH:
|
||
c.draw_arc(Vector2(10.5, 10.5) * k, 6.0 * k, 0.0, TAU, 24, color, w, true)
|
||
line.call(Vector2(15, 15), Vector2(20, 20))
|