Class hierarchy   Compound list   File list   Compound Members  

SpriteCache Class Reference

A Cache to avoid creating multiple instances of identical sprites. More...

List of all members.

Public Members


Detailed Description

A Cache to avoid creating multiple instances of identical sprites.

The key is only the name, in which case two sprites with the same name but with different solid setting are considered the same.


Member Function Documentation

SpriteCache::SpriteCache(ResourceStream& RS)

Construct a SpriteCache that will load its bitmaps from the specified ResourceStream.

Sprite* SpriteCache::load(char* name, int Solid=0, char *bitmapName=NULL, Rect2D r=Rect2D())

Load a sprite into the cache.

Notice: for each name there is only one sprite instance. If a sprite with the given name already exists in the cache, it is returned as is. use update() to modify settings.

if Solid != 0, collision info is generated for the sprite. if bitmapName == NULL, bitmapName is assumed to be the same as the sprite name. if r == Rect2D(0,0,-1,-1) (same as Rect2D()), the rect is the entire bitmap.

returns NULL if there is no resource named bitmapName (or name if bitmapName==NULL).

Sprite* SpriteCache::update(char* name, int Solid=0, char *bitmapName=NULL, Rect2D r=Rect2D())

update a sprite in the cache .

returns NULL if an entry does not exist in the cache for name.

Sprite* SpriteCache::get(char* name)

get from the cache a sprite pointer for the given name.

returns NULL if there is no sprite in the cache with the given name.


The documentation for this class was generated from the following file: