feat(render): #85 engine sprite-render system + deprecate bare draw_sprite
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 23s
ci / build-and-test (push) Successful in 2m20s
commit-lint / conventional-commits (push) Successful in 5s
docs / build-and-deploy (push) Successful in 28s

The engine already auto-ticks SpriteAnim/Motion; it now auto-DRAWS too.
Declare a Sprite component (id/offx/offy/scale/flip/tint/hidden, shipped from
ludic.core) on an entity with a Position and esys_sprite draws it each Render
frame — no hand-written Render handler, no hand animation (adds the SpriteAnim
frame when present). Registered on the engine-system registry (Render) and
spliced only when the game declares Sprite, so a game that never declares it
compiles byte-identically; opt out by omitting Sprite or `disable system
esys_sprite`.

Deprecates the bare draw_sprite/draw_sprite_scaled globals in favour of
Screen.sprite/Screen.sprite_scaled: a direct bare call emits a one-time
compile-time deprecation note (the bare form still lowers, since Screen.sprite
uses it); migrates the chronorift demo to the namespaced calls (golden render
byte-identical).

Example sprite_render (pixel-readback: engine draws the sprite, respects
hidden). Full suite 109/0, goldens byte-identical, fixpoint holds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-02 07:20:13 +03:00
parent d9287d6b1d
commit 57b8747c31
11 changed files with 18366 additions and 18002 deletions

View file

@ -41,6 +41,15 @@ property Collider {
hit: int = 0, entered: int = 0, exited: int = 0
}
# A drawable sprite (#85): declare it and the engine-owned sprite-render system
# draws the entity each Render frame from its Position — no hand-written Render
# handler. `id` is a sprite id (png_load / atlas cell); when the entity also carries
# SpriteAnim, the current animation frame is added to it. offx/offy offset from the
# Position anchor, scale is an integer zoom (0/1 = 1:1), flip mirrors horizontally,
# tint (non-zero) draws every opaque pixel in one colour (hit flash), hidden = 1
# skips it. Draw order is spawn order; a game wanting custom draw omits Sprite.
property Sprite { id: int = 0, offx: int = 0, offy: int = 0, scale: int = 1, flip: int = 0, tint: int = 0, hidden: int = 0 }
# Optional single config entity that turns the tile-grid broadphase on: solids are
# read from the Map.* tilemap. tile > 0 sets the tile size in px; wall is the solid
# glyph; oneway is an optional one-way-platform glyph (0 = none).

View file

@ -20,3 +20,4 @@ provides "Position"
provides "Body"
provides "Collider"
provides "Solids"
provides "Sprite"