Files
lilygo-t-deck/tron-room-demo
Dejvino d69c387f29 tron-room-demo: render the whole pipeline in RGB565 (real-HW color space)
The sketch now draws into a 16-bit 320x240 fb565 — the ST7789 panel's
native format — using the RGB565 palette constants straight from
nd_layout.h (C_FLOOR, C_WALL, C_COVER, C_DOOR, C_AIRLOCK, C_LINK,
C_PACKET, node colors). Shading/fog are integer fixed-point on the
5/6/5 channels so the banding matches what the MCU would produce; the
desktop window sees a 565-to-8888 expansion blit that stands in for the
SPI push (which ships 565 as-is on hardware).
2026-11-16 21:49:31 +01:00
..

tron-room-demo — RoomView

A top-down "3D" flythrough of NetDeck's demo map, built on the same emulator-only template as tron-demo (SDL3 host, 320x240 ABGR8888 framebuffer, setup()/loop() sketch contract — see the original template README below).

What makes this one different: the sketch renders the real Breach & Board demo floorplan from the firmware tree (src/netdeck/nd_demomap.h, consumed through the generic MapSource interface). There is no local copy of the map — edit the demo map in src/netdeck and this view follows it.

The whole render pipeline runs in RGB565 — the ST7789 panel's native format — with the palette taken directly from nd_layout.h. Shading and fog are integer fixed-point on the 5/6/5 channels, so the visible color banding is exactly what real hardware would produce. Only the final blit expands 565→8888 for the desktop window (the stand-in for the SPI push, which on the device ships the 565 buffer as-is).

What you see

  • A true 3D orbiting camera (position + look-at basis, perspective divide) drifting over the deck on a slow orbit with breathing radius/height.
  • # walls, o cover crates, the + blast door and the T terminal as solid shaded boxes: backface culling, painter's-algorithm depth sort, lambert lighting from above, distance fog, bright top rims.
  • Floor tiles as lit quads with a subtle checker.
  • The demo map's network graph as glowing pylons with teal link lines and cyan packets traveling along the edges.
  • Every entity from the demo spawn list walking its patrol route (marines cyan, droids orange, heavy red, turrets magenta), plus a pulsing halo over the airlock.

Keys

Key Action
a / d orbit faster / slower (or reverse)
w / s zoom in / out
r / f raise / lower the camera
space pause the camera drift + patrols
q / ESC quit

Build & Run

make run                # build + open a window
make smoke              # headless: 240 frames -> smoke_frame.bmp
make clean

The Makefile is the template's, with two changes: APP ?= RoomView and -I ../../src/netdeck on the include path.

Safety hatch / CLI options

Same as the template: --user-run (run indefinitely), --timeout MS, --frames N, --dump PATH. By default the emulator exits after 10 s; use ./RoomView-emu --user-run for interactive viewing.


T-Deck Emulator-Only Template (original README)

A minimal, self-contained SDL3 emulator template for prototyping 320x240 graphics/engine experiments without any hardware. No TFT_eSPI, no SPI, no I2S, no GPIO — just SDL3 and a framebuffer.

Do not edit src/main.cpp or shim.h — they are the host and are app-agnostic. The sketch lives in examples/$(APP)/$(APP).cpp and is compiled as a single translation unit with the host via -DAPP_SRC=….

Flag Description
--user-run Disable the 10 s auto-exit (interactive use)
--timeout MS Auto-exit after MS milliseconds (default 10000)
--frames N Exit after N frames instead
--dump PATH Save the last frame to PATH (BMP)