Files
flecs_tests/README.md

2.3 KiB

Cartograph

A browser-based world map creation tool inspired by Wonderdraft and Inkarnate. Uses line-strip vector shapes with procedural geometry.

Features

  • Shapes — procedural circles and stars with per-instance transforms (position, scale, rotation)
  • Shape editing — select, move, rotate, scale individual shapes; rect-select multiple shapes
  • Undo/redo — property-level history stack (position, scale, rotation, color) with edit session capture and batch operations
  • Spatial index — hash grid for fast hit testing and rect-selection queries on large shape counts
  • Viewport — zoom and pan with screen↔world coordinate transforms

Tech stack

Layer Library
Language C (C99)
Compiler Emscripten (emcc) → WebAssembly
Graphics Sokol with WebGPU backend
UI Dear ImGui via cimgui
Math cglm
Shaders WGSL (compiled to C headers via xxd)

Build

# Install dependencies
./fetch_libs.sh

# Release build
make

# Debug build
make debug

Output is app.html, served by Emscripten's built-in web server or any static server.

Project structure

src/
  main.c          Entry point, sokol init, render loop, input handling, UI panels, debug stats
  api.h           Central include — all library headers, ALLOC/FREE macros
  camera.h        Viewport state, zoom/pan, MVP matrix, screen↔world transforms
  render.h        Shape pipeline init/shutdown, per-shape draw calls
  shape.h         Shape geometry types, procedural generation, hit testing, buffer management
  spatial.h       Spatial hash grid for accelerated hit tests and rect-select queries
  history.h       Undo/redo stack with property-level tracking and batch operations
  util.h          Vector (dynamic array) and memory pool data structures
  rand.h          Xorshift32 PRNG utilities
  shaders/        WGSL shader sources (shape, sprite)
  generated/      xxd-generated C headers from shaders
lib/
  sokol/          Sokol single-file headers (gfx, app, glue, log)
  imgui/          Dear ImGui + cimgui
  cglm/           C linear math library
  util/           Sokol utility headers (memtrack, imgui integration)

License

MIT