NetDeck M0: emulator sandbox + design doc

- src/netdeck: DESIGN.md (RTwP cyber-tactical ship crawler for T-Deck),
  STATUS.md milestone tracker, nd_layout.h shared constants
- examples/NetDeck: M0 sandbox — 40x24 ship floorplan and 8-node sub-net
  in one shared coordinate space (door nodes pinned to bulkhead door
  tiles); Cameras/Network view modes via P (network overlaid as dotted
  outlines vs dimmed ship + full graph); trackball cursor (edge ISRs +
  momentum); Space tactical freeze with CRT scanlines; 20 Hz fixed-step
  sim (pause-verified frame-identical); keyboard @ I2C 0x55 groundwork
  for M2-M4
- emulator: APP=NetDeck support + Tab key host mapping
- platformio.ini: NetDeck src_dir ready for firmware build
This commit is contained in:
Dejvino
2026-11-14 10:37:35 +01:00
parent d542d6ffa7
commit 2bfd6c6428
9 changed files with 1063 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
/**
* @file nd_layout.h
* @brief NetDeck — Breach & Board: shared screen partition, palette and
* engine constants. Single source of truth for the 320x240
* layout described in DESIGN.md §3 and the fixed-timestep
* engine loop from DESIGN.md §6.
*
* Header-only: included by the sketch (examples/NetDeck) from both the
* PlatformIO firmware build and the SDL2 emulator build.
*/
#pragma once
#include <cstdint>
namespace nd {
// ---------------------------------------------------------------------------
// Screen partition (320x240): shared tactical view + HUD bar
// ---------------------------------------------------------------------------
// Physical reality and the logical network render into the SAME coordinate
// space (DESIGN.md §3): a bulkhead door tile and its network Door Node sit
// at the same spot. Two render modes over one 40x24 tile grid:
// Cameras mode — full ship view, network lightly overlaid as outlines
// Network mode — ship dimmed underneath, full network graph on top
constexpr int VIEW_X = 0, VIEW_Y = 0, VIEW_W = 320, VIEW_H = 192;
constexpr int HUD_X = 0, HUD_Y = 192, HUD_W = 320, HUD_H = 48;
constexpr int TILE = 8;
constexpr int TILE_COLS = VIEW_W / TILE; // 40
constexpr int TILE_ROWS = VIEW_H / TILE; // 24
// Sub-net node icons are 12x12.
constexpr int NODE_ICON = 12;
// ---------------------------------------------------------------------------
// Fixed-timestep engine (DESIGN.md §6)
// ---------------------------------------------------------------------------
constexpr uint32_t SIM_TICK_MS = 50; // 20 Hz deterministic logic tick
constexpr uint32_t FRAME_MS = 33; // ~30 fps render pacing
// Boot banner duration (also swallows stale keyboard bytes / floating pins).
constexpr uint32_t BOOT_MS = 1400;
// ---------------------------------------------------------------------------
// Palette (RGB565) — muted steel-blues for the deck, neon for signals
// ---------------------------------------------------------------------------
// deck pane
constexpr uint16_t C_FLOOR = 0x1905; // near-black blue corridor floor
constexpr uint16_t C_WALL = 0x42CD; // steel blue-gray hull
constexpr uint16_t C_COVER = 0x6225; // industrial crate brown-gray
constexpr uint16_t C_DOOR = 0xFD45; // amber blast door
constexpr uint16_t C_AIRLOCK = 0x07FF; // cyan breach airlock marker
constexpr uint16_t C_BEACON = 0x07FF; // cyan squad priority beacon
// net pane
constexpr uint16_t C_NETBG = 0x0000; // black logic space
constexpr uint16_t C_NODE = 0x2DAA; // green junction node
constexpr uint16_t C_ICE = 0xF800; // red ICE-locked firewall node
constexpr uint16_t C_HIVE = 0xF81F; // magenta droid hive node
constexpr uint16_t C_LINK = 0x2BCF; // teal network link trace
constexpr uint16_t C_GHOST = 0x2BCF; // cameras-mode overlay outline color
constexpr uint16_t C_PACKET = 0x07BF; // cyan data packet
constexpr uint16_t C_TRACE = 0xF800; // red enemy trace pulse
// HUD bar
constexpr uint16_t C_HUDBG = 0x0841; // near-black panel
constexpr uint16_t C_BORDER = 0x42CD; // pane separator steel
constexpr uint16_t C_TEXT = 0xFFFF; // primary text
constexpr uint16_t C_TEXTDIM = 0x8410; // secondary text
constexpr uint16_t C_GOOD = 0x07E0; // green meter fill
constexpr uint16_t C_WARN = 0xFFE0; // yellow meter fill
constexpr uint16_t C_HOT = 0xF800; // red meter fill
constexpr uint16_t C_CURSOR = 0xFFE0; // cursor cross, bright amber
constexpr uint16_t C_FREEZE = 0x07FF; // tactical-freeze tint accents
} // namespace nd