-moved card backs to Cache instead of ResourceManager
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-08-30 08:11:38 +00:00
parent 5afd1a45a2
commit 89419f90a7
7 changed files with 108 additions and 122 deletions

View File

@@ -1,10 +1,9 @@
#ifndef _TEXTURES_CACHE_H
#define _TEXTURES_CACHE_H
#define MAX_CACHE_OBJECTS 100
#define CACHE_SIZE_PIXELS 2000000
#define CACHE_CARD 1
#define CACHE_CARD 1
#define CACHE_THUMB 2
#include <JGE.h>
@@ -18,22 +17,22 @@ using std::map;
class MTGCard;
class CardTexture{
class CachedTexture{
protected:
int mtgid;
JTexture* tex;
JQuad* quad;
public:
int lastTime;
int type;
int nbpixels;
int getId();
JQuad * getQuad();
CardTexture(MTGCard * card, int type);
~CardTexture();
void init(string filename);
CachedTexture(MTGCard * card, int type);
CachedTexture(string filename);
~CachedTexture();
};
@@ -43,17 +42,18 @@ class TexturesCache{
int nb_textures;
int delete_previous;
int totalsize;
CardTexture * cache[MAX_CACHE_OBJECTS];
map<string,CachedTexture *> cache;
public:
int isInCache(MTGCard * card, int type=CACHE_CARD);
TexturesCache();
~TexturesCache();
int getOldestQuad();
void removeQuad(int id);
int removeOldestQuad();
void removeQuad(string id);
int cleanup();
int getCacheById(int id, int type=CACHE_CARD);
CachedTexture * getCacheByCard(MTGCard * card, int type=CACHE_CARD);
JQuad * getQuad(MTGCard * card, int type=CACHE_CARD);
JQuad * getThumb(MTGCard * card){return getQuad(card, CACHE_THUMB);};
JQuad * getQuad(string path,MTGCard * card = NULL, int type=0);
};
extern TexturesCache cache;