Detailed Description

SPA (SPrite Animation) is a custom file format which holds optimized sprite animations and also supports alpha. As it's a custom format, we also have a freely available tool on the website which will encode a series of images into an .SPA file. Important Note: You must add .bytes onto the end of any .spa file in your Resources folder, otherwise it won't work! (e.g. countdown.spa.bytes).

Public Member Functions

 SPA (string name, int frameWidth, int frameHeight, int frameRate)
 Creates a new empty SPA animation. More...
 
void ChangeFrameRate (int newRate)
 Changes the framerate of this animation. More...
 
void CreateSprites (int spriteCount, uint frameCount)
 Creates space for the given number of sprites which hold the given total number of frames. More...
 
 SPA (string name, byte[] binaryData)
 Creates a new SPA animation with the given name from the given binary data. More...
 
SPAInstance GetInstance ()
 Creates a playable instance of this animation. Instances are required as the same animation could be visible multiple times. More...
 

Static Public Member Functions

static void Clear ()
 Clears all active SPA animations. More...
 
static SPA Get (string name)
 Gets an already loaded SPA from the cache. More...
 
static int ActiveCount ()
 Gets how many animations are actively playing. More...
 
static void Update ()
 Advances playback of any running animations and performs some garbage collection. Called by UI.Update. More...
 

Public Attributes

int FrameRate
 The frame rate in frames/second. More...
 
int FrameWidth
 The width of a frame. More...
 
int FrameHeight
 The height of a frame. More...
 
uint FrameCount
 The number of frames in this animation. More...
 
SPASprite[] Sprites
 The set of sprites (images) in this animation. Note that a sprite can hold more than 1 frame. More...
 

Static Public Attributes

static SPAInstance LastInstance
 The tail of the linked list of actively playing animations. More...
 
static SPAInstance FirstInstance
 The head of the linked list of actively playing animations. More...
 

Properties

static Shader IsolationShader [get]
 The shader used to "isolate" things like animations from everything else. More...
 
SPASprite this[int id] [get]
 Gets a sprite with the given ID. More...
 

Static Private Attributes

static Shader RawIsolationShader
 The shader used to "isolate" things like animations from everything else. More...
 
static Dictionary< string, SPAInstances =new Dictionary<string,SPA>()
 A cache of all loaded SPA animations. If the garbage truck is active, it clears this. More...
 

Constructor & Destructor Documentation

PowerUI.SPA.SPA ( string  name,
int  frameWidth,
int  frameHeight,
int  frameRate 
)
inline

Creates a new empty SPA animation.

Parameters
nameThe name of the animation. Used for accessing the SPA from e.g. HTML.
spriteCountThe number of sprites in this animation.
frameRateThe framerate in fps.
PowerUI.SPA.SPA ( string  name,
byte[]  binaryData 
)
inline

Creates a new SPA animation with the given name from the given binary data.

Parameters
nameThe name of the animation. Used for caching purposes so the binary doesn't have to be reloaded if the animation is displayed multiple times.
binaryDataThe raw binary data of the spa file.

Member Function Documentation

static int PowerUI.SPA.ActiveCount ( )
inlinestatic

Gets how many animations are actively playing.

Returns
The number of animations currently playing.
void PowerUI.SPA.ChangeFrameRate ( int  newRate)
inline

Changes the framerate of this animation.

static void PowerUI.SPA.Clear ( )
inlinestatic

Clears all active SPA animations.

void PowerUI.SPA.CreateSprites ( int  spriteCount,
uint  frameCount 
)
inline

Creates space for the given number of sprites which hold the given total number of frames.

Parameters
spriteCountThe number of sprites.
frameCountThe total number of frames held by the sprites.
static SPA PowerUI.SPA.Get ( string  name)
inlinestatic

Gets an already loaded SPA from the cache.

Returns
An SPA object if found; null otherwise.
SPAInstance PowerUI.SPA.GetInstance ( )
inline

Creates a playable instance of this animation. Instances are required as the same animation could be visible multiple times.

Returns
A playable form of this animation.
static void PowerUI.SPA.Update ( )
inlinestatic

Advances playback of any running animations and performs some garbage collection. Called by UI.Update.

Member Data Documentation

SPAInstance PowerUI.SPA.FirstInstance
static

The head of the linked list of actively playing animations.

uint PowerUI.SPA.FrameCount

The number of frames in this animation.

int PowerUI.SPA.FrameHeight

The height of a frame.

int PowerUI.SPA.FrameRate

The frame rate in frames/second.

int PowerUI.SPA.FrameWidth

The width of a frame.

Dictionary<string,SPA> PowerUI.SPA.Instances =new Dictionary<string,SPA>()
staticprivate

A cache of all loaded SPA animations. If the garbage truck is active, it clears this.

SPAInstance PowerUI.SPA.LastInstance
static

The tail of the linked list of actively playing animations.

Shader PowerUI.SPA.RawIsolationShader
staticprivate

The shader used to "isolate" things like animations from everything else.

SPASprite [] PowerUI.SPA.Sprites

The set of sprites (images) in this animation. Note that a sprite can hold more than 1 frame.

Property Documentation

Shader PowerUI.SPA.IsolationShader
staticget

The shader used to "isolate" things like animations from everything else.

SPASprite PowerUI.SPA.this[int id]
get

Gets a sprite with the given ID.