2011-08-15 23:02:52 +02:00
|
|
|
#ifndef SPRITEMANAGER_H
|
|
|
|
#define SPRITEMANAGER_H
|
|
|
|
|
2011-08-19 14:26:26 +02:00
|
|
|
#include "declarations.h"
|
2011-08-15 23:02:52 +02:00
|
|
|
#include <framework/graphics/texture.h>
|
|
|
|
|
2011-08-19 16:18:24 +02:00
|
|
|
struct Sprite {
|
|
|
|
TexturePtr texture;
|
|
|
|
TexturePtr masks[4];
|
|
|
|
};
|
|
|
|
|
2011-08-15 23:02:52 +02:00
|
|
|
class SpriteManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SpriteManager();
|
|
|
|
|
2011-08-20 22:30:41 +02:00
|
|
|
bool load(const std::string& file);
|
2011-08-15 23:02:52 +02:00
|
|
|
void unload();
|
|
|
|
|
|
|
|
uint32 getSignature() { return m_signature; }
|
|
|
|
int getSpritesCount() { return m_spritesCount; }
|
2011-08-19 14:26:26 +02:00
|
|
|
|
2011-08-19 14:49:29 +02:00
|
|
|
TexturePtr getSpriteTexture(int id, SpriteMask mask = SpriteMaskNone);
|
2011-08-15 23:02:52 +02:00
|
|
|
|
|
|
|
private:
|
2011-08-19 16:18:24 +02:00
|
|
|
TexturePtr loadSpriteTexture(int id);
|
2011-08-19 16:23:02 +02:00
|
|
|
TexturePtr loadSpriteMask(TexturePtr spriteTex, SpriteMask mask);
|
2011-08-15 23:02:52 +02:00
|
|
|
|
|
|
|
uint32 m_signature;
|
|
|
|
uint16 m_spritesCount;
|
|
|
|
std::stringstream m_fin;
|
2011-08-19 16:18:24 +02:00
|
|
|
std::vector<Sprite> m_sprites;
|
2011-08-15 23:02:52 +02:00
|
|
|
TexturePtr m_transparentSprite;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SpriteManager g_sprites;
|
|
|
|
|
|
|
|
#endif
|