- src/netdeck/NetDeck.ino (git mv); the ../../src/netdeck include became a plain "nd_layout.h" - examples/NetDeck/platformio.ini: src_dir = ../../src/netdeck, -I . for utilities.h (pio build green: RAM 8.6%, Flash 5.6%) - emulator Makefile: NetDeck APP_DIR -> ../src/netdeck, extra -I for utilities.h; make APP=NetDeck + smoke verified green - STATUS.md: notes the new source layout
75 lines
3.5 KiB
C++
75 lines
3.5 KiB
C++
/**
|
|
* @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 (src/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
|