spaceship/tests/_icon_preview.gd
Loïc Wisniewski 85814ce88c Initial commit: SpaceshipTest, a top-down space RTS in Godot 4.7.1
A fleet of neon-outlined ships explores a procedurally generated, seeded
infinite world: tap/joystick steering, pinch zoom, formation pivoting,
planet landings, an ore economy with extractors and haulers, and player
built structures (mothership, ship crafter, command centre).

All art is hand-drawn with draw_* calls rather than textures, and the
backgrounds are camera-relative shaders so they stay precise at large
world coordinates.

Includes a 35-test headless suite (tests/run_tests.sh) plus screenshot
tooling that renders real frames through Xvfb and Mesa softpipe, since
--headless has no GPU.

Excluded from version control: .godot/ (import cache, and it holds
export credentials), builds/, android/build/ and packaged APKs - all
regenerable, and ~325 MB combined.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 18:41:58 +02:00

35 lines
1.2 KiB
GDScript

extends Control
# Preview scene - NOT run by run_tests.sh (underscore prefix). Draws every
# IconButton glyph at the size the build menu uses, so the art can be
# checked without rendering the whole game scene.
#
# bash tests/screenshot.sh res://tests/_icon_preview.tscn /tmp/out.png 20
const BUTTON_SIZE: float = 190.0
const COLUMNS: int = 3
const SWATCHES: Array = [
{"icon": 8, "color": Color(0.45, 0.9, 0.55)}, # mothership
{"icon": 9, "color": Color(1.0, 0.72, 0.25)}, # ship crafter
{"icon": 10, "color": Color(0.55, 0.6, 1.0)}, # command centre
{"icon": 11, "color": Color(0.35, 0.9, 0.75)}, # extractor
{"icon": 11, "color": Color(0.35, 0.9, 0.75), "enabled": false},
{"icon": 5, "color": Color(0.25, 0.85, 1.0)}, # generic build, for contrast
]
func _ready() -> void:
RenderingServer.set_default_clear_color(Color(0.02, 0.03, 0.06))
for i in range(SWATCHES.size()):
var swatch: Dictionary = SWATCHES[i]
var b: IconButton = IconButton.new()
b.icon = swatch.icon
b.glow_color = swatch.color
b.enabled = swatch.get("enabled", true)
b.size = Vector2(BUTTON_SIZE, BUTTON_SIZE)
b.position = Vector2(
120.0 + float(i % COLUMNS) * (BUTTON_SIZE + 60.0),
100.0 + float(i / COLUMNS) * (BUTTON_SIZE + 60.0)
)
add_child(b)