Tables are cards on a felt board, joined by copper pipes that carry a roll from one table to the next. Play mode rolls with a flicker and a bead down each pipe; Build mode edits names, results, ranges and pipes. - core/: data model (RollTable, TableEntry, TowerBoard), sample board with a d100 table of 100 trinkets and a weighted d100 range table, and a Roller with a depth limit - ui/: board with pan and zoom, pipe and port layers, collapsible table cards, result tray with earlier rolls, undo toasts, and a Collapse all / Expand all button - assets/fonts/: Rokkitt and Atkinson Hyperlegible (SIL OFL) - tests/test_roller.gd: headless checks for the model and roller Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
863 B
GDScript
29 lines
863 B
GDScript
class_name ChevronButton
|
|
extends Button
|
|
## Collapse/expand toggle: a chevron pointing down when open, right when collapsed.
|
|
|
|
var open: bool = true:
|
|
set(value):
|
|
open = value
|
|
queue_redraw()
|
|
|
|
|
|
func _init() -> void:
|
|
custom_minimum_size = Vector2(26, 26)
|
|
flat = false
|
|
focus_mode = FOCUS_ALL
|
|
var normal := Style.box(Color(0, 0, 0, 0), 6)
|
|
var hover := Style.box(Color("#e6dfcd"), 6)
|
|
Style.skin_button(self, normal, hover, hover, Style.MUTED)
|
|
mouse_entered.connect(queue_redraw)
|
|
mouse_exited.connect(queue_redraw)
|
|
|
|
|
|
func _draw() -> void:
|
|
var c := size / 2.0
|
|
var pts: PackedVector2Array
|
|
if open:
|
|
pts = PackedVector2Array([c + Vector2(-4, -2), c + Vector2(0, 2), c + Vector2(4, -2)])
|
|
else:
|
|
pts = PackedVector2Array([c + Vector2(-2, -4), c + Vector2(2, 0), c + Vector2(-2, 4)])
|
|
draw_polyline(pts, Style.INK if is_hovered() else Style.MUTED, 2.0, true)
|