The Sprite class
The sprite class contains primitives to load, display and
manipulate sprites.
See also: Widget
Example:
dofile("SDK/Graphics2D.lua")
-- Load a sprite without caption
sprite = Sprite(20,20,90,90,"maps/sprite.png", "")
-- Add sprite to the main canvas
mainCanvas:addWidget(sprite)
function onSceneUpdate()
-- Rotate sprite by 2° every frame
sprite:rotate(2)
end
Sprite(x,y,w,h,file,text)
Loads a texture into memory and creates a Sprite object with it.
Parameter
x
The x position on the canvas
y
The y position on the canvas
w
The width of the widget
h
The height of the widget
file
The image file to load
text
(optional) The label of the widget