Sprite Sheet Caching
A serious efficiency and scalability limitation is our lack of Sprite Sheet caching. Currently, each instance of an Animation has its own Sprite Sheet in memory. This is inefficient and misses the point of Sprite Sheets. This blue print should address the how and when of sprite sheet loading and the where of sprite sheet accessing.
Preliminary discussion has lead us to the conclusion that Sprite Sheets will be loaded as needed and stored in a cache. We may, at some point, change the 'when' and 'where' of the Sprite Sheet loading. Until then, the cache that we design today will be useful in the future.
The Cache will allow for two operations: storage and retrieval. Since the a Sprite Sheet is really just an SDL_Surface*, the Cache will live in the Graphics Engine SystemComponent.
SpriteSheetCache + void store(std::string name, SDL_Surface* spriteSheet); + SDL_Surface* retrieve(std::string name);
The 'name' field is actually the Sprite Sheet's unique filename.
Very straightforward and simple to implement. SpriteSheetCache will wrap some kind of container. Initially the container may be nothing more than an std::vector. As more Sprite Sheets become available we may find the the container should be optimized further.
Sprite Sheets will be stored in $PKG/spritesheet and installed to /usr/share/asgard/spritesheet/.