Sprite loading was a bare png_load — one file per 16x16 sprite, no way to load one sheet and address a cell by grid coords or name. Adds a Sprite.*/Assets.* runtime (atlas.ludic) over the variable-size image loader, so a cell is a sub-rect of the kept image and is NOT restricted to the 16x16 sprite table: Sprite.sheet(path,cw,ch), Sprite.cell(sheet,col,row), Sprite.cell_span(sheet,col,row,cols,rows) (a sprite may span >1 cell), Sprite.define/named (name + lookup), Sprite.draw/draw_scaled (through camera/zoom/clip like Screen.sprite), Sprite.width/height, and Assets.image/load/get. Spliced on demand (Sprite.sheet/… or Assets.*), so a program using neither is byte-identical. Example examples/library/atlas.ludic (verified against a real 12x11 Kenney sheet, incl. a 2x3 multi-cell span and named lookup). 14 docs pages. Full suite 114/0, goldens byte-identical, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
323 B
Markdown
14 lines
323 B
Markdown
---
|
|
id: sprite-width
|
|
name: Sprite.width
|
|
category: sprite
|
|
kind: namespace-method
|
|
tokens: Sprite.width
|
|
sig: Sprite.width(id) -> int
|
|
tip: The atlas sprite's width in pixels.
|
|
order: 8
|
|
ns: Sprite
|
|
member: width
|
|
---
|
|
|
|
Returns the pixel width of atlas sprite <code>id</code> (its sub-rect width) — handy for centering and layout.
|