- fix issue 215
- added test for purple screen (this is the small white square on top of the loading screen)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-11-23 08:25:27 +00:00
parent e364b17117
commit 66a505969e
29 changed files with 110 additions and 151 deletions

View File

@@ -42,6 +42,7 @@ public:
bool LoadResource(const string& resourceName);
virtual void RemoveAll();
virtual void RemoveJLBFonts();
virtual int CreateTexture(const string &textureName);
virtual JTexture* GetTexture(const string &textureName);
@@ -51,36 +52,19 @@ public:
virtual JQuad* GetQuad(const string &quadName);
virtual JQuad* GetQuad(int id);
virtual int LoadJLBFont(const string &fontName, int height);
virtual JLBFont * LoadJLBFont(const string &fontName, int height);
virtual JLBFont* GetJLBFont(const string &fontName);
virtual JLBFont* GetJLBFont(int id);
// int RegisterParticleEffect(const string &effectName);
// JParticleEffect* GetParticleEffect(const string &effectName);
// JParticleEffect* GetParticleEffect(int id);
//
// int RegisterMotionEmitter(const string &emitterName);
// JMotionEmitter* GetMotionEmitter(const string &emitterName);
// JMotionEmitter* GetMotionEmitter(int id);
protected:
//JRenderer *mRenderer;
//string mResourceRoot;
vector<JTexture *> mTextureList;
map<string, int> mTextureMap;
vector<JQuad *> mQuadList;
map<string, int> mQuadMap;
// vector<JParticleEffect *> mParticleEffectList;
// map<string, int> mParticleEffectMap;
//
// vector<JMotionEmitter *> mMotionEmitterList;
// map<string, int> mMotionEmitterMap;
vector<JLBFont *> mFontList;
map<string, int> mFontMap;
};

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -55,6 +55,13 @@ JResourceManager::~JResourceManager()
RemoveAll();
}
void JResourceManager::RemoveJLBFonts(){
for (vector<JLBFont *>::iterator font = mFontList.begin(); font != mFontList.end(); ++font)
delete *font;
mFontList.clear();
mFontMap.clear();
}
void JResourceManager::RemoveAll()
{
@@ -70,11 +77,7 @@ void JResourceManager::RemoveAll()
mQuadList.clear();
mQuadMap.clear();
for (vector<JLBFont *>::iterator font = mFontList.begin(); font != mFontList.end(); ++font)
delete *font;
mFontList.clear();
mFontMap.clear();
RemoveJLBFonts();
}
@@ -82,10 +85,6 @@ bool JResourceManager::LoadResource(const string& resourceName)
{
string path = /*mResourceRoot + */resourceName;
// TiXmlDocument doc(path.c_str());
//
// if (!doc.LoadFile()) return false;
JGE *engine = JGE::GetInstance();
if (engine == NULL) return false;
@@ -164,11 +163,6 @@ bool JResourceManager::LoadResource(const string& resourceName)
else
hotspotY = height/2;
// if (element->QueryFloatAttribute("regx", &value) == TIXML_SUCCESS)
// hotspotX = width/2;
//
// if (element->QueryFloatAttribute("regy", &value) == TIXML_SUCCESS)
// hotspotY = height/2;
int id = CreateQuad(quadName, textureName, x, y, width, height);
if (id != INVALID_ID)
@@ -179,14 +173,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
else if (strcmp(element->Value(), "font")==0)
{
}
// else if (strcmp(element->Value(), "effect")==0)
// {
// RegisterParticleEffect(element->Attribute("name"));
// }
// else if (strcmp(element->Value(), "motion_emitter")==0)
// {
// RegisterMotionEmitter(element->Attribute("name"));
// }
}
}
@@ -297,26 +284,22 @@ JQuad *JResourceManager::GetQuad(int id)
}
int JResourceManager::LoadJLBFont(const string &fontName, int height)
JLBFont * JResourceManager::LoadJLBFont(const string &fontName, int height)
{
map<string, int>::iterator itr = mFontMap.find(fontName);
if (itr == mFontMap.end())
{
string path = /*mResourceRoot + */fontName;
if (itr != mFontMap.end()) return mFontList[itr->second];
printf("creating font:%s\n", path.c_str());
string path = fontName;
int id = mFontList.size();
///////////////////////////////////////
mFontList.push_back(NEW JLBFont(path.c_str(), height, true));
int id = mFontList.size();
mFontMap[fontName] = id;
mFontList.push_back(NEW JLBFont(path.c_str(), height, true));
mFontMap[fontName] = id;
return mFontList[id];
return id;
}
else
return itr->second;
}

View File

@@ -76,22 +76,12 @@ void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
}
// void JQuad::SetColor(JColor color)
// {
// for (int i=0;i<4;i++)
// mColor[i].color = color.color;
// }
//
void JQuad::SetColor(PIXEL_TYPE color)
{
for (int i=0;i<4;i++)
mColor[i].color = color;
}
void JQuad::SetHotSpot(float x, float y)
{
mHotSpotX = x;