v0.1.0: software map renderer + SDL3 window viewer

This commit is contained in:
EnderTheCoder
2026-09-12 01:02:49 +08:00
parent 3ad380c81e
commit b35372da52
13 changed files with 659 additions and 31 deletions
+31 -16
View File
@@ -4,22 +4,26 @@ OpenRA3 is organised as a stack of C++ modules. Each layer may import the ones
below it, never the ones above.
```
┌───────────────────────────────┐
applications │ openra3 (apps/openra3) │
└───────────────┬───────────────┘
│ import ra3
┌───────────────▼───────────────┐
umbrella │ ra3 (re-exports everything) │
└───────────────┬───────────────┘
┌───────────────┬────────┴────────┬───────────────┐
▼ ▼ ▼ ▼
ra3.skirmish ra3.client ra3.game ra3.map
match rules display/loop RA3 sides map catalog
│ │ │ │
└───────┬───────┴────────┬────────┘ │
▼ ▼ ▼
ra3.logic ra3.core ra3.fs
simulation types/math/random BIG4 + RefPack
┌───────────────────────────────────────┐
applications │ openra3 (apps/openra3) │
└───────────────────┬───────────────────┘
│ import ra3
┌───────────────────▼───────────────────┐
umbrella │ ra3 (re-exports everything) │
└───────────────────┬───────────────────┘
┌──────────────┬───────────────┼───────────────┬──────────────┐
▼ ▼ ▼ ▼ ▼
ra3.ui ra3.render ra3.skirmish ra3.client ra3.game
SDL3 window framebuffer match rules display/loop RA3 sides
│ │ │ │ │
└──────┬───────┘ └───────┬───────┘ │
▼ ▼ │
ra3.core ra3.logic │
simulation │
┌───────────────────────────────────────┬──────────────────────┘
▼ ▼
ra3.map ra3.fs
map catalog BIG4 + RefPack
```
## Module responsibilities
@@ -64,6 +68,17 @@ The minimal match: two players, unit classes (harvester/infantry/tank/base),
passive + harvester income, a simple build AI, movement and combat on a fixed
30 Hz step, and a base-destruction win condition. Fully deterministic.
### `ra3.render`
A dependency-free software renderer: an ARGB8888 `image` framebuffer with
blit/line/circle primitives, a TGA decoder for the game's map art, a 24-bit BMP
encoder for headless output, and `compose` which overlays a world grid and
markers (start positions, live units) onto the map art.
### `ra3.ui`
The windowed viewer. The SDL3 backend streams the rendered image to a texture
with pan/zoom and Esc-to-quit; when the build has no SDL3, a null backend
returns `false` so the caller writes an offscreen image instead.
## Design rules
1. **No raw owning pointers.** Ownership is `std::unique_ptr`; the partition