Axel Meyer e5ccf55e98 chore: add Tier-1 LICENSE file
Adds the proprietary all-rights-reserved license that applies to this
library. The text is identical to the engine LICENSE — this lib is
Tier-1 official platform content, distributed under the same terms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:04:41 +02:00
2026-05-16 18:04:41 +02:00

lib-core.render

Colored-quad tile-grid renderer. Reads lib-core.maps's current (or specified) map + its tilemap, iterates tiles, draws one colored rect per tile via engine.render.draw_rect. Fallback to magenta [255, 0, 255] for tiles with missing or malformed color.

Version: 0.1.0
Lib-ID: lib-core.render
Requires: lib-core.maps v>=0.1.1
Tags: render, tiles, draw, colored-quads

Topology

graph LR
  this["lib-core.render"]
  lib_core_maps["lib-core.maps"]
  this --> lib_core_maps
  engine["engine.*"]
  this --> engine

API

render.draw_map(map_id)

Syntax: render.draw_map(map_id: string | nil) -> integer

Example:

function render(ctx)
    engine.render.clear_color(engine.render.rgb(20, 20, 30))
    local n = render.draw_map()  -- uses current-map
end

Description: Iterates the tiles of the specified map (or current-map when nil), drawing one colored rect per tile at (tx * tile_size, ty * tile_size). Tile color is read from the tilemap's tile.color = {r, g, b}; if missing or malformed, falls back to magenta as a visible "missing-color" debug-marker. Must be called from inside a render hook. Returns the number of tiles drawn (for smoke verification + debug).

Conventions

  • Colored-quads only in v0.1.0. Texture-rendering, multi-layer composition, post-processing, parallax, shaders, hot-reload all DEPRECATED-MVP.
  • World-space coords; pair with lib-core.camera to support panning + zoom.
  • Magenta fallback [255, 0, 255] is intentional: high-visibility debug-marker for malformed color-data.
  • Y-down-positive per ADR-0031.

Consumer pattern

local maps   = require("lib-core.maps")
local render = require("lib-core.render")
local camera = require("lib-core.camera")

function render_fn(ctx)
    engine.render.clear_color(engine.render.rgb(20, 20, 30))
    camera.begin()
    render.draw_map()
    camera.finish()
end

CHANGELOG

v0.1.0 (P.0)

  • Initial release: draw_map colored-quad iterator.

References

  • Spec v0.1.0 (P.0): meta/docs/superpowers/specs/2026-05-09-p0-lib-render-design.md
  • Architecture: meta/docs/architecture/render-pipeline.md
  • ADR-0001 (engine knows verbs, libs bring nouns)
  • ADR-0031 (pixel-convention: Y-down-positive)
  • ADR-0038 (API-Doc-Convention)
Description
P.0.lib.render � colored-quad tile-grid renderer
Readme 58 KiB
Languages
Lua 94.2%
Shell 5.8%