return table details in docs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -4,15 +4,15 @@ local _active_sprites = {}
|
||||
|
||||
--- Registers a sprite definition.
|
||||
--- @within Sprite
|
||||
-- @param sprite_data table A table containing the sprite definition.
|
||||
-- @param sprite_data.id string Unique sprite identifier.
|
||||
-- @param[opt] sprite_data.s number Sprite index for single-sprite mode.
|
||||
-- @param[opt] sprite_data.colorkey number Default color index for transparency.
|
||||
-- @param[opt] sprite_data.scale number Default scaling factor.
|
||||
-- @param[opt] sprite_data.flip_x number Set to 1 to flip horizontally by default.
|
||||
-- @param[opt] sprite_data.flip_y number Set to 1 to flip vertically by default.
|
||||
-- @param[opt] sprite_data.rot number Default rotation in degrees.
|
||||
-- @param[opt] sprite_data.sprites table Array of sub-sprite tables for composite sprites. Each entry has: `s` (number) sprite index, `x_offset` (number) horizontal offset, `y_offset` (number) vertical offset, and optional `colorkey`, `scale`, `flip_x`, `flip_y`, `rot` overrides.
|
||||
--- @param sprite_data table A table containing the sprite definition.
|
||||
--- @param sprite_data.id string Unique sprite identifier.
|
||||
--- @param[opt] sprite_data.s number Sprite index for single-sprite mode.
|
||||
--- @param[opt] sprite_data.colorkey number Default color index for transparency.
|
||||
--- @param[opt] sprite_data.scale number Default scaling factor.
|
||||
--- @param[opt] sprite_data.flip_x number Set to 1 to flip horizontally by default.
|
||||
--- @param[opt] sprite_data.flip_y number Set to 1 to flip vertically by default.
|
||||
--- @param[opt] sprite_data.rot number Default rotation in degrees.
|
||||
--- @param[opt] sprite_data.sprites table Array of sub-sprite tables for composite sprites. Each entry has: `s` (number) sprite index, `x_offset` (number) horizontal offset, `y_offset` (number) vertical offset, and optional `colorkey`, `scale`, `flip_x`, `flip_y`, `rot` overrides.
|
||||
function Sprite.register(sprite_data)
|
||||
if not sprite_data or not sprite_data.id then
|
||||
trace("Error: Invalid sprite object registered (missing id)!")
|
||||
@@ -26,14 +26,14 @@ end
|
||||
|
||||
--- Schedules a sprite for drawing.
|
||||
--- @within Sprite
|
||||
-- @param id string The unique identifier of the sprite.
|
||||
-- @param x number The x-coordinate.
|
||||
-- @param y number The y-coordinate.
|
||||
-- @param[opt] colorkey number The color index for transparency.
|
||||
-- @param[opt] scale number The scaling factor.
|
||||
-- @param[opt] flip_x number Set to 1 to flip horizontally.
|
||||
-- @param[opt] flip_y number Set to 1 to flip vertically.
|
||||
-- @param[opt] rot number The rotation in degrees.
|
||||
--- @param id string The unique identifier of the sprite.
|
||||
--- @param x number The x-coordinate.
|
||||
--- @param y number The y-coordinate.
|
||||
--- @param[opt] colorkey number The color index for transparency.
|
||||
--- @param[opt] scale number The scaling factor.
|
||||
--- @param[opt] flip_x number Set to 1 to flip horizontally.
|
||||
--- @param[opt] flip_y number Set to 1 to flip vertically.
|
||||
--- @param[opt] rot number The rotation in degrees.
|
||||
function Sprite.show(id, x, y, colorkey, scale, flip_x, flip_y, rot)
|
||||
if not _sprites[id] then
|
||||
trace("Error: Attempted to show non-registered sprite with id: " .. id)
|
||||
@@ -54,7 +54,7 @@ end
|
||||
|
||||
--- Hides a displayed sprite.
|
||||
--- @within Sprite
|
||||
-- @param id string The unique identifier of the sprite.
|
||||
--- @param id string The unique identifier of the sprite.
|
||||
function Sprite.hide(id)
|
||||
_active_sprites[id] = nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user