Erwan
-moved card backs to Cache instead of ResourceManager
This commit is contained in:
@@ -29,6 +29,7 @@ struct CardGui : public PlayGuiObject {
|
|||||||
void RenderBig(const Pos&);
|
void RenderBig(const Pos&);
|
||||||
virtual void Update(float dt);
|
virtual void Update(float dt);
|
||||||
static void alternateRender(MTGCard * card, const Pos& pos);
|
static void alternateRender(MTGCard * card, const Pos& pos);
|
||||||
|
static JQuad * alternateThumbQuad(MTGCard * card);
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef _TEXTURES_CACHE_H
|
#ifndef _TEXTURES_CACHE_H
|
||||||
#define _TEXTURES_CACHE_H
|
#define _TEXTURES_CACHE_H
|
||||||
|
|
||||||
#define MAX_CACHE_OBJECTS 100
|
|
||||||
#define CACHE_SIZE_PIXELS 2000000
|
#define CACHE_SIZE_PIXELS 2000000
|
||||||
|
|
||||||
#define CACHE_CARD 1
|
#define CACHE_CARD 1
|
||||||
@@ -18,22 +17,22 @@ using std::map;
|
|||||||
|
|
||||||
class MTGCard;
|
class MTGCard;
|
||||||
|
|
||||||
class CardTexture{
|
class CachedTexture{
|
||||||
protected:
|
protected:
|
||||||
int mtgid;
|
|
||||||
|
|
||||||
JTexture* tex;
|
JTexture* tex;
|
||||||
JQuad* quad;
|
JQuad* quad;
|
||||||
public:
|
public:
|
||||||
int lastTime;
|
int lastTime;
|
||||||
int type;
|
int type;
|
||||||
int nbpixels;
|
int nbpixels;
|
||||||
int getId();
|
|
||||||
|
|
||||||
JQuad * getQuad();
|
JQuad * getQuad();
|
||||||
|
|
||||||
CardTexture(MTGCard * card, int type);
|
void init(string filename);
|
||||||
~CardTexture();
|
CachedTexture(MTGCard * card, int type);
|
||||||
|
CachedTexture(string filename);
|
||||||
|
~CachedTexture();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -43,17 +42,18 @@ class TexturesCache{
|
|||||||
int nb_textures;
|
int nb_textures;
|
||||||
int delete_previous;
|
int delete_previous;
|
||||||
int totalsize;
|
int totalsize;
|
||||||
CardTexture * cache[MAX_CACHE_OBJECTS];
|
map<string,CachedTexture *> cache;
|
||||||
public:
|
public:
|
||||||
int isInCache(MTGCard * card, int type=CACHE_CARD);
|
int isInCache(MTGCard * card, int type=CACHE_CARD);
|
||||||
TexturesCache();
|
TexturesCache();
|
||||||
~TexturesCache();
|
~TexturesCache();
|
||||||
int getOldestQuad();
|
int removeOldestQuad();
|
||||||
void removeQuad(int id);
|
void removeQuad(string id);
|
||||||
int cleanup();
|
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 * getQuad(MTGCard * card, int type=CACHE_CARD);
|
||||||
JQuad * getThumb(MTGCard * card){return getQuad(card, CACHE_THUMB);};
|
JQuad * getThumb(MTGCard * card){return getQuad(card, CACHE_THUMB);};
|
||||||
|
JQuad * getQuad(string path,MTGCard * card = NULL, int type=0);
|
||||||
};
|
};
|
||||||
extern TexturesCache cache;
|
extern TexturesCache cache;
|
||||||
|
|
||||||
|
|||||||
@@ -68,18 +68,8 @@ void CardGui::Render()
|
|||||||
icon = GameApp::CommonRes->GetQuad("c_blue");
|
icon = GameApp::CommonRes->GetQuad("c_blue");
|
||||||
if (icon) icon->SetHotSpot(16,16);
|
if (icon) icon->SetHotSpot(16,16);
|
||||||
|
|
||||||
{
|
JQuad* q = alternateThumbQuad(card);
|
||||||
JQuad* q;
|
if (q){
|
||||||
// Draw the "unknown" card model
|
|
||||||
switch(color)
|
|
||||||
{
|
|
||||||
case Constants::MTG_COLOR_GREEN: q = GameApp::CommonRes->GetQuad("green_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_BLUE : q = GameApp::CommonRes->GetQuad("blue_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_RED : q = GameApp::CommonRes->GetQuad("red_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_BLACK: q = GameApp::CommonRes->GetQuad("black_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_WHITE: q = GameApp::CommonRes->GetQuad("white_thumb"); break;
|
|
||||||
default: q = GameApp::CommonRes->GetQuad("black_thumb"); break;
|
|
||||||
}
|
|
||||||
q->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
q->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||||
renderer->RenderQuad(q, actX, actY, actT, scale, scale);
|
renderer->RenderQuad(q, actX, actY, actT, scale, scale);
|
||||||
}
|
}
|
||||||
@@ -103,6 +93,20 @@ void CardGui::Render()
|
|||||||
PlayGuiObject::Render();
|
PlayGuiObject::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JQuad * CardGui::alternateThumbQuad(MTGCard * card){
|
||||||
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
|
JQuad * q;
|
||||||
|
switch(card->getColor())
|
||||||
|
{
|
||||||
|
case Constants::MTG_COLOR_GREEN: q = cache.getQuad("sets/green_thumb.jpg");break;
|
||||||
|
case Constants::MTG_COLOR_BLUE : q = cache.getQuad("sets/blue_thumb.jpg");break;
|
||||||
|
case Constants::MTG_COLOR_RED : q = cache.getQuad("sets/red_thumb.jpg");break;
|
||||||
|
case Constants::MTG_COLOR_BLACK: q = cache.getQuad("sets/black_thumb.jpg");break;
|
||||||
|
case Constants::MTG_COLOR_WHITE: q = cache.getQuad("sets/white_thumb.jpg");break;
|
||||||
|
default: q = cache.getQuad("sets/black_thumb.jpg");break;
|
||||||
|
}
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||||
// Draw the "unknown" card model
|
// Draw the "unknown" card model
|
||||||
@@ -110,12 +114,12 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
JQuad * q;
|
JQuad * q;
|
||||||
switch(card->getColor())
|
switch(card->getColor())
|
||||||
{
|
{
|
||||||
case Constants::MTG_COLOR_GREEN: q = GameApp::CommonRes->GetQuad("green"); break;
|
case Constants::MTG_COLOR_GREEN: q = cache.getQuad("sets/green.jpg");break;
|
||||||
case Constants::MTG_COLOR_BLUE : q = GameApp::CommonRes->GetQuad("blue"); break;
|
case Constants::MTG_COLOR_BLUE : q = cache.getQuad("sets/blue.jpg");break;
|
||||||
case Constants::MTG_COLOR_RED : q = GameApp::CommonRes->GetQuad("red"); break;
|
case Constants::MTG_COLOR_RED : q = cache.getQuad("sets/red.jpg");break;
|
||||||
case Constants::MTG_COLOR_BLACK: q = GameApp::CommonRes->GetQuad("black"); break;
|
case Constants::MTG_COLOR_BLACK: q = cache.getQuad("sets/black.jpg");break;
|
||||||
case Constants::MTG_COLOR_WHITE: q = GameApp::CommonRes->GetQuad("white"); break;
|
case Constants::MTG_COLOR_WHITE: q = cache.getQuad("sets/white.jpg");break;
|
||||||
default: q = GameApp::CommonRes->GetQuad("black"); break;
|
default: q = cache.getQuad("sets/black.jpg");break;
|
||||||
}
|
}
|
||||||
float scale = pos.actZ * 250 / q->mHeight;
|
float scale = pos.actZ * 250 / q->mHeight;
|
||||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
|
|||||||
@@ -127,38 +127,6 @@ void GameApp::Create()
|
|||||||
CommonRes->CreateTexture("backdrop.jpg");
|
CommonRes->CreateTexture("backdrop.jpg");
|
||||||
CommonRes->CreateTexture("handback.png");
|
CommonRes->CreateTexture("handback.png");
|
||||||
|
|
||||||
CommonRes->CreateTexture("red.jpg");
|
|
||||||
CommonRes->CreateTexture("white.jpg");
|
|
||||||
CommonRes->CreateTexture("blue.jpg");
|
|
||||||
CommonRes->CreateTexture("black.jpg");
|
|
||||||
CommonRes->CreateTexture("green.jpg");
|
|
||||||
CommonRes->CreateQuad("red", "red.jpg", 0, 0, 200, 285);
|
|
||||||
CommonRes->CreateQuad("white", "white.jpg", 0, 0, 200, 285);
|
|
||||||
CommonRes->CreateQuad("blue", "blue.jpg", 0, 0, 200, 285);
|
|
||||||
CommonRes->CreateQuad("black", "black.jpg", 0, 0, 200, 285);
|
|
||||||
CommonRes->CreateQuad("green", "green.jpg", 0, 0, 200, 285);
|
|
||||||
CommonRes->GetQuad("red")->SetHotSpot(100, 145);
|
|
||||||
CommonRes->GetQuad("white")->SetHotSpot(100, 145);
|
|
||||||
CommonRes->GetQuad("blue")->SetHotSpot(100, 145);
|
|
||||||
CommonRes->GetQuad("black")->SetHotSpot(100, 145);
|
|
||||||
CommonRes->GetQuad("green")->SetHotSpot(100, 145);
|
|
||||||
|
|
||||||
CommonRes->CreateTexture("red_thumb.jpg");
|
|
||||||
CommonRes->CreateTexture("white_thumb.jpg");
|
|
||||||
CommonRes->CreateTexture("blue_thumb.jpg");
|
|
||||||
CommonRes->CreateTexture("black_thumb.jpg");
|
|
||||||
CommonRes->CreateTexture("green_thumb.jpg");
|
|
||||||
CommonRes->CreateQuad("red_thumb", "red_thumb.jpg", 0, 0, 28, 40);
|
|
||||||
CommonRes->CreateQuad("white_thumb", "white_thumb.jpg", 0, 0, 28, 40);
|
|
||||||
CommonRes->CreateQuad("blue_thumb", "blue_thumb.jpg", 0, 0, 28, 40);
|
|
||||||
CommonRes->CreateQuad("black_thumb", "black_thumb.jpg", 0, 0, 28, 40);
|
|
||||||
CommonRes->CreateQuad("green_thumb", "green_thumb.jpg", 0, 0, 28, 40);
|
|
||||||
CommonRes->GetQuad("red_thumb")->SetHotSpot(14, 20);
|
|
||||||
CommonRes->GetQuad("white_thumb")->SetHotSpot(14, 20);
|
|
||||||
CommonRes->GetQuad("blue_thumb")->SetHotSpot(14, 20);
|
|
||||||
CommonRes->GetQuad("black_thumb")->SetHotSpot(14, 20);
|
|
||||||
CommonRes->GetQuad("green_thumb")->SetHotSpot(14, 20);
|
|
||||||
|
|
||||||
CommonRes->CreateTexture("BattleIcon.png");
|
CommonRes->CreateTexture("BattleIcon.png");
|
||||||
CommonRes->CreateTexture("DefenderIcon.png");
|
CommonRes->CreateTexture("DefenderIcon.png");
|
||||||
CommonRes->CreateTexture("shadow.png");
|
CommonRes->CreateTexture("shadow.png");
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ void ManaCost::Dump(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i< nbhybrids; i++){
|
for (unsigned int i=0; i< nbhybrids; i++){
|
||||||
ManaCostHybrid * h = hybrids[i];
|
ManaCostHybrid * h = hybrids[i];
|
||||||
|
|
||||||
sprintf(buf, "H:{%c:%i}/{%c:%i}", Constants::MTGColorChars[h->color1], h->value1, Constants::MTGColorChars[h->color2], h->value2);
|
sprintf(buf, "H:{%c:%i}/{%c:%i}", Constants::MTGColorChars[h->color1], h->value1, Constants::MTGColorChars[h->color2], h->value2);
|
||||||
|
|||||||
@@ -71,17 +71,8 @@ ShopItem::ShopItem(int id, JLBFont *font, int _cardid, float _xy[], bool hasFocu
|
|||||||
|
|
||||||
thumb = cache.getThumb(card);
|
thumb = cache.getThumb(card);
|
||||||
|
|
||||||
if (!thumb){
|
if (!thumb) thumb = CardGui::alternateThumbQuad(card);
|
||||||
switch(card->getColor())
|
|
||||||
{
|
|
||||||
case Constants::MTG_COLOR_GREEN: thumb = GameApp::CommonRes->GetQuad("green_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_BLUE : thumb = GameApp::CommonRes->GetQuad("blue_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_RED : thumb = GameApp::CommonRes->GetQuad("red_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_BLACK: thumb = GameApp::CommonRes->GetQuad("black_thumb"); break;
|
|
||||||
case Constants::MTG_COLOR_WHITE: thumb = GameApp::CommonRes->GetQuad("white_thumb"); break;
|
|
||||||
default: thumb = GameApp::CommonRes->GetQuad("black_thumb"); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (thumb){
|
if (thumb){
|
||||||
mesh=NEW hgeDistortionMesh(2,2);
|
mesh=NEW hgeDistortionMesh(2,2);
|
||||||
mesh->SetTexture(thumb->mTex);
|
mesh->SetTexture(thumb->mTex);
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ TexturesCache::TexturesCache(){
|
|||||||
totalsize = 0;
|
totalsize = 0;
|
||||||
delete_previous = 0;
|
delete_previous = 0;
|
||||||
lastTime = 0;
|
lastTime = 0;
|
||||||
for (int i=0; i<MAX_CACHE_OBJECTS;i++)
|
|
||||||
cache[i] = NULL;
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char buf [4096];
|
char buf [4096];
|
||||||
sprintf(buf, " Init TextureCache : %p\n", this);
|
sprintf(buf, " Init TextureCache : %p\n", this);
|
||||||
@@ -21,81 +19,102 @@ TexturesCache::TexturesCache(){
|
|||||||
|
|
||||||
TexturesCache::~TexturesCache(){
|
TexturesCache::~TexturesCache(){
|
||||||
LOG("==Destroying TexturesCache==");
|
LOG("==Destroying TexturesCache==");
|
||||||
for (int i = 0; i < nb_textures; i++){
|
for (map<string,CachedTexture*>::iterator it = cache.begin(); it != cache.end(); ++it){
|
||||||
delete cache[i];
|
delete it->second;
|
||||||
}
|
}
|
||||||
LOG("==Destroying TexturesCache Successful==");
|
LOG("==Destroying TexturesCache Successful==");
|
||||||
}
|
}
|
||||||
|
|
||||||
int TexturesCache::isInCache(MTGCard * card, int type){
|
int TexturesCache::isInCache(MTGCard * card, int type){
|
||||||
int cache_id = getCacheById(card->getId(), type);
|
CachedTexture * tex = getCacheByCard(card, type);
|
||||||
if (cache_id == -1)
|
if (tex) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TexturesCache::getCacheById(int id, int type){
|
CachedTexture * TexturesCache::getCacheByCard(MTGCard *card, int type){
|
||||||
for (int i=0; i<nb_textures;i++){
|
char _filename[512];
|
||||||
if (cache[i]->type == type && cache[i]->getId() == id){
|
if (type == CACHE_THUMB){
|
||||||
return i;
|
sprintf(_filename, "sets/%s/thumbnails/%s", card->getSetName(), card->getImageName());
|
||||||
|
}else{
|
||||||
|
sprintf(_filename, "sets/%s/%s", card->getSetName(), card->getImageName());
|
||||||
}
|
}
|
||||||
}
|
string filename = _filename;
|
||||||
return -1;
|
return cache[filename];
|
||||||
}
|
}
|
||||||
|
|
||||||
int TexturesCache::getOldestQuad(){
|
|
||||||
|
int TexturesCache::removeOldestQuad(){
|
||||||
int oldest = -1;
|
int oldest = -1;
|
||||||
int result = -1;
|
string result = "";
|
||||||
for (int i= 0; i < nb_textures; i++){
|
for (map<string,CachedTexture*>::iterator it = cache.begin(); it != cache.end(); ++it){
|
||||||
if (oldest == -1 || oldest > cache[i]->lastTime){
|
if (it->second && (oldest == -1 || oldest > it->second->lastTime)){
|
||||||
oldest = cache[i]->lastTime;
|
oldest = it->second->lastTime;
|
||||||
result = i;
|
result = it->first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
if (oldest != -1){
|
||||||
|
removeQuad(result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TexturesCache::removeQuad(int id){
|
void TexturesCache::removeQuad(string id){
|
||||||
totalsize -= cache[id]->nbpixels;
|
totalsize -= cache[id]->nbpixels;
|
||||||
delete cache[id];
|
delete cache[id];
|
||||||
cache[id] = cache[nb_textures - 1];
|
cache.erase(id);
|
||||||
cache[nb_textures - 1] = NULL;
|
|
||||||
nb_textures--;
|
nb_textures--;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TexturesCache::cleanup(){
|
int TexturesCache::cleanup(){
|
||||||
int maxSize = options[Options::CACHESIZE].number * 100000;
|
int maxSize = options[Options::CACHESIZE].number * 100000;
|
||||||
if (!maxSize) maxSize = CACHE_SIZE_PIXELS;
|
if (!maxSize) maxSize = CACHE_SIZE_PIXELS;
|
||||||
while (nb_textures >= MAX_CACHE_OBJECTS - 1 || totalsize > maxSize){
|
while (totalsize > maxSize){
|
||||||
int i = getOldestQuad();
|
int result = removeOldestQuad();
|
||||||
if (i == -1) return 0;
|
if (!result) return 0;
|
||||||
removeQuad(i);
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
JQuad * TexturesCache::getQuad(MTGCard * card, int type){
|
JQuad * TexturesCache::getQuad(string filename,MTGCard * card, int type){
|
||||||
int cache_id = getCacheById(card->getId(), type);
|
CachedTexture * ctex = cache[filename];
|
||||||
if (cache_id == -1){
|
if (!ctex){
|
||||||
|
|
||||||
//Not found in the cache, we have to load the file and put it in the cache
|
|
||||||
if (cleanup()){
|
if (cleanup()){
|
||||||
cache_id = nb_textures;
|
if (card) cache[filename] = NEW CachedTexture(card,type);
|
||||||
cache[cache_id] = NEW CardTexture(card, type);
|
else cache[filename] = NEW CachedTexture(filename);
|
||||||
totalsize+= cache[cache_id]->nbpixels;
|
totalsize+= cache[filename]->nbpixels;
|
||||||
fprintf(stderr, "Total Size of cache in pixels: %i\n", totalsize);
|
fprintf(stderr, "Total Size of cache in pixels: %i\n", totalsize);
|
||||||
nb_textures++;
|
nb_textures++;
|
||||||
|
}else{
|
||||||
|
//Error
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cache[cache_id]->lastTime = lastTime++;
|
cache[filename]->lastTime = lastTime++;
|
||||||
return cache[cache_id]->getQuad();
|
return cache[filename]->getQuad();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CardTexture::getId(){
|
JQuad * TexturesCache::getQuad(MTGCard * card, int type){
|
||||||
return mtgid;
|
char _filename[512];
|
||||||
|
if (type == CACHE_THUMB){
|
||||||
|
sprintf(_filename, "sets/%s/thumbnails/%s", card->getSetName(), card->getImageName());
|
||||||
|
}else{
|
||||||
|
sprintf(_filename, "sets/%s/%s", card->getSetName(), card->getImageName());
|
||||||
|
}
|
||||||
|
string filename = _filename;
|
||||||
|
return getQuad(filename,card,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
CardTexture::CardTexture(MTGCard * card, int _type): type(_type){
|
|
||||||
|
CachedTexture::CachedTexture(string filename){
|
||||||
|
quad = NULL;
|
||||||
|
tex = NULL;
|
||||||
|
nbpixels = 0;
|
||||||
|
lastTime = 0;
|
||||||
|
if (fileExists(filename.c_str())) init(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
CachedTexture::CachedTexture(MTGCard * card, int _type){
|
||||||
LOG("==Creating CardTexture Object");
|
LOG("==Creating CardTexture Object");
|
||||||
JFileSystem* fs = JFileSystem::GetInstance();
|
JFileSystem* fs = JFileSystem::GetInstance();
|
||||||
char filename[100];
|
char filename[100];
|
||||||
@@ -111,7 +130,7 @@ CardTexture::CardTexture(MTGCard * card, int _type): type(_type){
|
|||||||
|
|
||||||
if (fileExists(filename)){
|
if (fileExists(filename)){
|
||||||
fs->DetachZipFile();
|
fs->DetachZipFile();
|
||||||
tex = JRenderer::GetInstance()->LoadTexture(filename, false,GU_PSM_5551);
|
init(filename);
|
||||||
}else{
|
}else{
|
||||||
char zipname[100];
|
char zipname[100];
|
||||||
sprintf(zipname, "Res/sets/%s/%s.zip", card->getSetName(),card->getSetName());
|
sprintf(zipname, "Res/sets/%s/%s.zip", card->getSetName(),card->getSetName());
|
||||||
@@ -122,23 +141,26 @@ CardTexture::CardTexture(MTGCard * card, int _type): type(_type){
|
|||||||
}else{
|
}else{
|
||||||
sprintf(filename, "%s", card->getImageName());
|
sprintf(filename, "%s", card->getImageName());
|
||||||
}
|
}
|
||||||
tex = JRenderer::GetInstance()->LoadTexture(filename, false,GU_PSM_5551);
|
init(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG("CardTexture Object Creation succesful");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CachedTexture::init(string filename){
|
||||||
|
tex = JRenderer::GetInstance()->LoadTexture(filename.c_str(), false,GU_PSM_5551);
|
||||||
if (tex){
|
if (tex){
|
||||||
quad = NEW JQuad(tex, 0.0f, 0.0f, tex->mWidth, tex->mHeight);
|
quad = NEW JQuad(tex, 0.0f, 0.0f, tex->mWidth, tex->mHeight);
|
||||||
quad->SetHotSpot(tex->mWidth / 2, tex->mHeight / 2);
|
quad->SetHotSpot(tex->mWidth / 2, tex->mHeight / 2);
|
||||||
nbpixels = tex->mTexHeight * tex->mTexWidth;
|
nbpixels = tex->mTexHeight * tex->mTexWidth;
|
||||||
}
|
}
|
||||||
mtgid = card->getId();
|
|
||||||
LOG("CardTexture Object Creation succesful");
|
|
||||||
}
|
}
|
||||||
|
JQuad * CachedTexture::getQuad(){
|
||||||
JQuad * CardTexture::getQuad(){
|
|
||||||
return quad;
|
return quad;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardTexture::~CardTexture(){
|
CachedTexture::~CachedTexture(){
|
||||||
LOG("==Deleting CardTexture Object");
|
LOG("==Deleting CardTexture Object");
|
||||||
SAFE_DELETE(quad);
|
SAFE_DELETE(quad);
|
||||||
SAFE_DELETE(tex);
|
SAFE_DELETE(tex);
|
||||||
|
|||||||
Reference in New Issue
Block a user