Files
tidewall/tools/app_icon.gd
T
claudeandClaude Opus 5.5 f3161bf46c R2: Debian package, desktop entry, launcher and application icon
- make deb (tools/deb.sh) builds tidewall_<version>-1_amd64.deb with
  dpkg-deb: launchers in /usr/games, the game in /usr/lib/tidewall, a
  validated desktop entry, hicolor icons, man pages, a DEP-5 copyright,
  the engine's licences and md5sums. No maintainer scripts. Depends on
  libc6 (>= 2.28), from the binary's GLIBC symbol versions.
- make deb-check (tools/deb_check.sh) checks it in a throwaway debian:13
  container: apt install with no recommends, desktop-file-validate,
  icons, man pages and licences, tidewall on a user's PATH, the server
  and the game headless as a user, lintian, and a purge that leaves
  nothing behind.
- The tarball gains a tidewall launcher (any directory, through a
  symlink), install-desktop-entry.sh (per-user menu entry, --remove),
  tidewall.png and ENGINE-LICENSES.txt (Godot's MIT text and bundled
  notices, which R1 lacked). make dist-check covers the launcher and the
  menu entry.
- Application icon: a hand-written SVG in palette colours, rendered to
  16-512 px by make app-icon, and set as the window icon.
  test_app_icon checks the renders, the colours and the setting.
- Fix: looping ambience played into the Dummy audio driver could be
  reported as resources in use at exit. Directors play nothing without
  real audio output (SoundBank.has_output()) and stop their voices on
  exit.

Tests: make check (648), make dist-check, make deb-check all pass.

Closes #61

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:12:47 -05:00

49 lines
1.6 KiB
GDScript

## R2: renders the application icon, assets/icons/app/tidewall.svg (written by hand),
## to the PNG sizes desktops ask for: assets/icons/app/tidewall-<N>.png. Deterministic,
## so `make app-icon` after editing the SVG and commit what changes.
##
## tools/godot.sh --script res://tools/app_icon.gd [-- --out=DIR]
extends SceneTree
const SOURCE: String = "res://assets/icons/app/tidewall.svg"
const SIZES: Array[int] = [16, 24, 32, 48, 64, 128, 256, 512]
## The SVG's own width and height.
const SVG_SIDE: float = 256.0
func _init() -> void:
var out: String = "res://assets/icons/app"
for arg: String in OS.get_cmdline_user_args():
if arg.begins_with("--out="):
out = arg.get_slice("=", 1)
var svg: String = FileAccess.get_file_as_string(SOURCE)
if svg.is_empty():
push_error("app_icon: can't read %s" % SOURCE)
quit(1)
return
DirAccess.make_dir_recursive_absolute(out)
for side: int in SIZES:
var image: Image = render(svg, side)
if image == null:
quit(1)
return
var path: String = "%s/tidewall-%d.png" % [out, side]
if image.save_png(path) != OK:
push_error("app_icon: can't write %s" % path)
quit(1)
return
print("app_icon: %s" % path)
quit(0)
## The icon at `side` pixels square, or null.
static func render(svg: String, side: int) -> Image:
var image: Image = Image.new()
if image.load_svg_from_string(svg, side / SVG_SIDE) != OK:
push_error("app_icon: the SVG doesn't load")
return null
if image.get_width() != side or image.get_height() != side:
image.resize(side, side, Image.INTERPOLATE_LANCZOS)
image.convert(Image.FORMAT_RGBA8)
return image