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 (int frameWidth, int frameHeight, int frameRate) | |
| Creates a new empty SPA animation. More... | |
| 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... | |
| SPACharacter | GetCharacter (int charcode) |
| Gets a character from this SPA, if it exists. More... | |
| SPAMapEntry | GetFromMap (int index) |
| Gets the entry from the map. Index is most often e.g. charcode. More... | |
| void | AddToMap (int index, SPAMapEntry entry) |
| Adds the given map entry to the map. More... | |
| SPAInstance | GetInstance () |
| Creates a playable instance of this animation. Instances are required as the same animation could be visible multiple times. More... | |
| SPASprite | GetSprite (int id) |
| Gets a sprite with the given ID. 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 (float deltaTime) |
| Advances playback of any running animations and performs some garbage collection. Called by UI.Update. More... | |
| static implicit | operator SpaFormat (SPA spa) |
| Implicitly converts an SPA into an SPAFormat object. Used when adding an SPA to the image cache. More... | |
Public Attributes | |
| Gif.Gif | ParentGif |
| The GIF object that this SPA is for. More... | |
| 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... | |
| SPAFontMeta | FontMeta |
| Font meta, if this is being used as a font. More... | |
| Dictionary< int, SPAMapEntry > | Map |
| A map which essentially describes the location of invididual images on each frame. Used mainly when SPA's are utilised as fonts. 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 | |
| bool | HasMap [get] |
| True if this SPA has a map. More... | |
| SPASprite | this[int id] [get] |
| Gets a sprite with the given ID. More... | |
Static Private Attributes | |
| static Dictionary< string, SPA > | Instances =new Dictionary<string,SPA>() |
| A cache of all loaded SPA animations. If the garbage truck is active, it clears this. More... | |
|
inline |
|
inline |
|
inline |
Creates a new SPA animation with the given name from the given binary data.
| name | The name of the animation. Used for caching purposes so the binary doesn't have to be reloaded if the animation is displayed multiple times. |
| binaryData | The raw binary data of the spa file. |
|
inlinestatic |
Gets how many animations are actively playing.
|
inline |
Adds the given map entry to the map.
|
inline |
Changes the framerate of this animation.
|
inlinestatic |
Clears all active SPA animations.
|
inline |
Creates space for the given number of sprites which hold the given total number of frames.
| spriteCount | The number of sprites. |
| frameCount | The total number of frames held by the sprites. |
|
inlinestatic |
|
inline |
Gets a character from this SPA, if it exists.
|
inline |
Gets the entry from the map. Index is most often e.g. charcode.
|
inline |
Creates a playable instance of this animation. Instances are required as the same animation could be visible multiple times.
|
inline |
Gets a sprite with the given ID.
|
inlinestatic |
Advances playback of any running animations and performs some garbage collection. Called by UI.Update.
|
static |
The head of the linked list of actively playing animations.
| SPAFontMeta Spa.SPA.FontMeta |
Font meta, if this is being used as a font.
| uint Spa.SPA.FrameCount |
The number of frames in this animation.
| int Spa.SPA.FrameHeight |
The height of a frame.
| int Spa.SPA.FrameRate |
The frame rate in frames/second.
| int Spa.SPA.FrameWidth |
The width of a frame.
A cache of all loaded SPA animations. If the garbage truck is active, it clears this.
|
static |
The tail of the linked list of actively playing animations.
| Dictionary<int,SPAMapEntry> Spa.SPA.Map |
A map which essentially describes the location of invididual images on each frame. Used mainly when SPA's are utilised as fonts.
| SPASprite [] Spa.SPA.Sprites |
The set of sprites (images) in this animation. Note that a sprite can hold more than 1 frame.
|
get |
True if this SPA has a map.
|
get |
Gets a sprite with the given ID.