Class Sprite
Sprite
This class inherits all methods from these classes: Actor
Methods
sprite:GetAnimationLengthSeconds () | Returns the length of the animation in seconds. |
sprite:GetDecodeMovie () | Gets whether the Sprite should call the decode function for its texture during updates. |
sprite:GetNumStates () | Return the number of states this Sprite has. |
sprite:GetState () | Returns the Sprite's current state (frame number in a multi-frame sprite). |
sprite:GetTexture () | Returns the Sprite's texture. |
sprite:LinearFrames () | Returns a Frames table consisting of iNumFrames frames lasting for a total of fSeconds seconds. |
sprite:Load (string, sPath) | If sPath is nil , then unload the texture. |
sprite:LoadBackground (string, sPath) | Load the song background texture at sPath . |
sprite:LoadBanner (string, sPath) | Load the song banner texture at sPath . |
sprite:LoadFromCached (string, sType, string, sPath) | Loads the image of type sType from the cache based on sPath . |
sprite:LoadFromCurrentSongBackground () | Loads the background from the current Song or the first Trail entry. |
sprite:LoadFromSongBackground (song) | Load the texture for Song background. |
sprite:LoadFromSongBanner (song) | Load the texture for Song banner. |
sprite:SetCustomImageRect (float, fLeft, float, fTop, float, fRight, float, fBottom) | Sets the custom image rectangle. |
sprite:SetCustomPosCoords (float, ulx, float, uly, float, llx, float, lly, float, lrx, float, lry, float, urx, float, ury) | Sets custom offsets for the corners of the Sprite. |
sprite:StopUsingCustomPosCoords () | Turns off the custom pos coords for the sprite. |
sprite:SetDecodeMovie (bool, decode) | Sets whether the Sprite should call the decode function for its texture during updates. |
sprite:SetEffectMode (EffectMode, mode) | Set the to mode . |
sprite:SetSecondsIntoAnimation (float, fSeconds) | Sets the number of seconds into the animation to fSeconds . |
sprite:SetStateProperties (table) | Sets the properties of the states of the sprite. |
sprite:SetTexture (RageTexture, texture) | Set the texture to texture . |
sprite:addimagecoords (float, fX, float, fY) | XXX: how does this work? |
sprite:customtexturerect (float, fLeft, float, fTop, float, fRight, float, fBottom) | Allows the themer to set a custom texture rectangle that effects the way the texture is drawn. |
sprite:get_use_effect_clock_for_texcoords () | Returns true if the sprite is using the effect clock for texcoordvelocity. |
sprite:loop (bLoop) | Call loop on the RageTexture |
sprite:position (fPos) | Call position on the RageTexture |
sprite:rate (fRate) | Call rate on the RageTexture |
sprite:scaletoclipped (float, fWidth, float, fHeight) | Scale the Sprite to width fWidth and height fHeight clipping if the dimensions do not match. |
sprite:setstate (iNewState) | Set the Sprite's state to iNewState . |
sprite:set_use_effect_clock_for_texcoords (bool, use) | If use is true, then the sprite will use the effect clock for texcoordvelocity. |
sprite:stretchtexcoords (float, fX, float, fY) | XXX: What does this do? |
sprite:texcoordvelocity (float, fVelX, float, fVelY) | Set the texture coordinate velocity which controls how the Sprite changes as it animates. |
sprite:CropTo (float, fWidth, float, fHeight) | Crops the Sprite to fWidth xfHeight . |
sprite:cropto (float, fWidth, float, fHeight) | Alias for CropTo |
sprite:SetAllStateDelays (float, fRate) | Sets all the state delays to fRate . |
Methods
- sprite:GetAnimationLengthSeconds ()
-
Returns the length of the animation in seconds.
Returns:
-
float
- sprite:GetDecodeMovie ()
-
Gets whether the Sprite should call the decode function for its texture during updates.
Returns:
-
bool
- sprite:GetNumStates ()
-
Return the number of states this Sprite has.
Returns:
-
int
- sprite:GetState ()
-
Returns the Sprite's current state (frame number in a multi-frame sprite).
Returns:
-
int
- sprite:GetTexture ()
-
Returns the Sprite's texture.
Returns:
-
RageTexture
- sprite:LinearFrames ()
-
Returns a Frames table consisting of iNumFrames frames lasting for a total of fSeconds seconds. This function is not a member function and should be used as Frames = Sprite.LinearFrames( 5, 2.6 ).
Returns:
-
Frames
- sprite:Load (string, sPath)
-
If
sPath
isnil
, then unload the texture. Otherwise, load the texture at pathsPath
.Parameters:
- string
- sPath
Returns:
-
void
- sprite:LoadBackground (string, sPath)
-
Load the song background texture at
sPath
.Parameters:
- string
- sPath
Returns:
-
void
- sprite:LoadBanner (string, sPath)
-
Load the song banner texture at
sPath
.Parameters:
- string
- sPath
Returns:
-
void
- sprite:LoadFromCached (string, sType, string, sPath)
-
Loads the image of type
sType
from the cache based onsPath
.Internal types: "Banner", "Background", "CDTitle", "Jacket", "CDImage" and "Disc".
Parameters:
- string
- sType
- string
- sPath
Returns:
-
void
- sprite:LoadFromCurrentSongBackground ()
-
Loads the background from the current Song or the first Trail entry.
Returns:
-
void
- sprite:LoadFromSongBackground (song)
-
Load the texture for Song background.
Parameters:
- song Song
Returns:
-
void
- sprite:LoadFromSongBanner (song)
-
Load the texture for Song banner.
Parameters:
- song Song
Returns:
-
void
- sprite:SetCustomImageRect (float, fLeft, float, fTop, float, fRight, float, fBottom)
-
Sets the custom image rectangle. (Works in image pixel space.)
Parameters:
- float
- fLeft
- float
- fTop
- float
- fRight
- float
- fBottom
Returns:
-
void
- sprite:SetCustomPosCoords (float, ulx, float, uly, float, llx, float, lly, float, lrx, float, lry, float, urx, float, ury)
-
Sets custom offsets for the corners of the Sprite. Coordinates are paired,
corner order is upper left, lower left, lower right, upper right.
Parameters:
- float
- ulx
- float
- uly
- float
- llx
- float
- lly
- float
- lrx
- float
- lry
- float
- urx
- float
- ury
Returns:
-
void
- sprite:StopUsingCustomPosCoords ()
-
Turns off the custom pos coords for the sprite.
Returns:
-
void
- sprite:SetDecodeMovie (bool, decode)
-
Sets whether the Sprite should call the decode function for its texture during updates.
Parameters:
- bool
- decode
Returns:
- sprite:SetEffectMode (EffectMode, mode)
-
Set the to
mode
.Parameters:
- EffectMode
- mode
Returns:
-
void
- sprite:SetSecondsIntoAnimation (float, fSeconds)
-
Sets the number of seconds into the animation to
fSeconds
.Parameters:
- float
- fSeconds
Returns:
-
void
- sprite:SetStateProperties (table)
-
Sets the properties of the states of the sprite. The properties table is identical to the "Frames" table that can be put in the sprite when calling Def.Sprite.
Example:<br /> {{Frame= 0, Delay= .016, {0, 0}, {.25, .25}},<br /> {Frame= 1, Delay= .016, {0, 0}, {.25, .25}},<br /> {Frame= 2, Delay= .016, {0, 0}, {.25, .25}},<br /> {Frame= 3, Delay= .016, {0, 0}, {.25, .25}},<br /> }<br /> Frame is optional, defaulting to 0.<br /> Delay is optional, defaulting to 0.<br /> The two tables are optional upper left and lower right corners of the fraction of the frame to use. The example makes the sprite only use the upper left corner of each frame.<br /> Simpler example:<br /> {{Frame= 0, Delay= .016}, {Frame= 1, Delay= .016}, {Frame= 2, Delay= .016}, {Frame= 3, Delay= .016}}<br /> This example makes the sprite use the whole of each frame.
Parameters:
- table
Returns:
-
void
- sprite:SetTexture (RageTexture, texture)
-
Set the texture to
texture
.Parameters:
- RageTexture
- texture
Returns:
-
void
- sprite:addimagecoords (float, fX, float, fY)
-
XXX: how does this work?
Parameters:
- float
- fX
- float
- fY
Returns:
-
void
- sprite:customtexturerect (float, fLeft, float, fTop, float, fRight, float, fBottom)
-
Allows the themer to set a custom texture rectangle that effects the way the texture is drawn.
Parameters:
- float
- fLeft
- float
- fTop
- float
- fRight
- float
- fBottom
Returns:
-
void
- sprite:get_use_effect_clock_for_texcoords ()
-
Returns true if the sprite is using the effect clock for texcoordvelocity.
Returns:
-
bool
- sprite:loop (bLoop)
-
Call loop on the RageTexture
Parameters:
- bLoop
Returns:
-
bool
- sprite:position (fPos)
-
Call position on the RageTexture
Parameters:
- fPos
Returns:
-
bool
- sprite:rate (fRate)
-
Call rate on the RageTexture
Parameters:
- fRate
Returns:
-
bool
- sprite:scaletoclipped (float, fWidth, float, fHeight)
-
Scale the Sprite to width
fWidth
and heightfHeight
clipping if the dimensions do not match.Parameters:
- float
- fWidth
- float
- fHeight
Returns:
-
void
- sprite:setstate (iNewState)
-
Set the Sprite's state to
iNewState
.Parameters:
- iNewState
Returns:
-
void
- sprite:set_use_effect_clock_for_texcoords (bool, use)
-
If
use
is true, then the sprite will use the effect clock for texcoordvelocity.Parameters:
- bool
- use
Returns:
- sprite:stretchtexcoords (float, fX, float, fY)
-
XXX: What does this do?
Parameters:
- float
- fX
- float
- fY
Returns:
-
void
- sprite:texcoordvelocity (float, fVelX, float, fVelY)
-
Set the texture coordinate velocity which controls how the Sprite changes as it animates. A velocity of 1 makes the texture scroll all the way once per second.
Parameters:
- float
- fVelX
- float
- fVelY
Returns:
-
void
- sprite:CropTo (float, fWidth, float, fHeight)
-
Crops the Sprite to
fWidth
xfHeight
.Parameters:
- float
- fWidth
- float
- fHeight
Returns:
-
void
- sprite:cropto (float, fWidth, float, fHeight)
-
Alias for CropTo
Parameters:
- float
- fWidth
- float
- fHeight
- sprite:SetAllStateDelays (float, fRate)
-
Sets all the state delays to
fRate
. Useful for Sprites that need to change by BPM (e.g. Tran from DDR 5th Mix, the cube from DS EuroMix 2).Parameters:
- float
- fRate
Returns:
-
void