spaceship/NeonPanel.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

47 lines
2.1 KiB
GDScript

class_name NeonPanel
extends Control
# A bounded dialog card drawn in the game's own style: a dark chamfered
# body with a glowing border and bright corner brackets. Chamfered rather
# than square because cut corners read as "console panel" and match the
# hard-edged neon of the buttons and HUD.
#
# Draws itself from its own rect, so it can be sized freely in the scene.
@export var glow_color: Color = Color(0.25, 0.85, 1.0)
@export var core_color: Color = Color(1.0, 1.0, 1.0)
# Fully opaque: at even 97% the bright neon of whatever sits behind the
# panel ghosts through and makes the text harder to read.
@export var fill_color: Color = Color(0.02, 0.03, 0.07, 1.0)
@export var corner_cut: float = 26.0
@export var bracket_length: float = 46.0
func _draw() -> void:
var w: float = size.x
var h: float = size.y
var c: float = corner_cut
var body: PackedVector2Array = PackedVector2Array([
Vector2(c, 0.0), Vector2(w - c, 0.0),
Vector2(w, c), Vector2(w, h - c),
Vector2(w - c, h), Vector2(c, h),
Vector2(0.0, h - c), Vector2(0.0, c),
])
draw_colored_polygon(body, fill_color)
NeonDraw.draw_glowing_polygon(self, body, glow_color, 1.0, core_color)
# Corner brackets: short doubled strokes just inside each cut corner,
# which is what gives it the heads-up-display feel rather than looking
# like a plain outlined box.
var b: float = bracket_length
var inset: float = 10.0
var corners: Array = [
[Vector2(inset, c + inset), Vector2(inset, c + inset + b), Vector2(c + inset, inset), Vector2(c + inset + b, inset)],
[Vector2(w - inset, c + inset), Vector2(w - inset, c + inset + b), Vector2(w - c - inset, inset), Vector2(w - c - inset - b, inset)],
[Vector2(inset, h - c - inset), Vector2(inset, h - c - inset - b), Vector2(c + inset, h - inset), Vector2(c + inset + b, h - inset)],
[Vector2(w - inset, h - c - inset), Vector2(w - inset, h - c - inset - b), Vector2(w - c - inset, h - inset), Vector2(w - c - inset - b, h - inset)],
]
for corner in corners:
NeonDraw.draw_glowing_line(self, corner[0], corner[1], glow_color, 0.9, 0.3, core_color)
NeonDraw.draw_glowing_line(self, corner[2], corner[3], glow_color, 0.9, 0.3, core_color)