Engine sprite-render system: auto-draw Sprite/SpriteAnim components; namespace draw_sprite #85
Labels
No labels
area:ci
area:docs
area:input
area:net
area:rendering
area:repo
area:stdlib
area:tooling
area:types
cleanup
dx
priority:high
priority:low
priority:medium
proposal
status:in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: workshopsoft/ludic#85
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There is no engine system that draws entities' sprites. Games write a manual Render handler that queries positions and calls
draw_spriteper entity, and hand-animate. The engine already auto-ticks SpriteAnim/Motion; it should also auto-DRAW a Sprite/SpriteAnim component (layer/offset/flip/tint, camera, z-order) so the common case is declarative: attach a Sprite, the engine renders it. Games opt out for custom draw.Also:
draw_sprite/draw_sprite_scaledare bare unnamespaced globals;Screen.spritealready exists — the bare aliases should be deprecated/removed so the API is consistently namespaced.Shipped in
57b8747(real implementation, tested — full suite 109/0, golden renders byte-identical, C-free bootstrap fixpoint intact).Engine sprite-render system. The engine already auto-ticks SpriteAnim/Motion; it now auto-draws too. Declare a
Spritecomponent (id + optional offx/offy/scale/flip/tint/hidden, shipped from ludic.core) on an entity with aPositionandesys_spritedraws it each Render frame — no hand-written Render handler querying positions and calling draw_sprite per entity, and no hand animation: when the entity also carriesSpriteAnim, the current frame is added to the base id automatically. It is registered on the compile-time engine-system registry for the Render phase and spliced only when a game declaresSprite, so a game that never declares it compiles byte-identically; a game wanting a custom draw omitsSpriteordisable system esys_sprite.Namespaced draw_sprite. The bare
draw_sprite/draw_sprite_scaledglobals are deprecated in favour ofScreen.sprite/Screen.sprite_scaled: a direct bare call now emits a one-time compile-time deprecation note (the bare form still lowers, sinceScreen.spriteuses it internally), and the in-repochronoriftdemo is migrated to the namespaced calls (its golden render is byte-identical).Verified by
examples/library/sprite_render.ludic: declares Sprite from ludic.core on two entities, empty Render handler, and pixel-readback confirms the engine drew the shown sprite and skipped thehiddenone. Wired as a controller_case; docs updated.