Refactoring of some of the font management in WResourceManager. This change looks bigger than it actually is - most of the touched files are simply renaming of some font enums that I moved out of MTGDefinitions into the resource manager header files. The main points of this change: collapsing the font containers into a single map, eliminating duplicated functions, and migrating the font building logic into the resource manager class. GameApp doesn't need to know anything about the fonts it uses, and likewise, font users don't need to know what the name of their chosen font is, just the FONT_TYPE enum.

(I did a cursory check to make sure chinese still displays correctly - at a glance, I'm seeing what looks correct to someone who doesn't read the language :) )
This commit is contained in:
wrenczes@gmail.com
2010-10-19 07:51:32 +00:00
parent f64c2b0183
commit 5aa3dc6fd3
34 changed files with 313 additions and 354 deletions

View File

@@ -178,16 +178,12 @@ public:
JTexture* GetTexture(const string &textureName);
JTexture* GetTexture(int id);
int reloadWFonts();
int reloadWLBFonts();
//Wrapped from JResourceManger. TODO: Privatize
WFont * LoadWLBFont(const string &fontName, int height);
WFont * LoadWFBFont(const string &fontName, int height);
WFont * GetWFont(const string &fontName);
WFont * GetWFont(int id);
WFont * GetWLBFont(int id);
// Font management functions
void InitFonts(const std::string& inLang);
int ReloadWFonts();
WFont* LoadWFont(const string& inFontname, int inFontHeight, int inFontID);
WFont* GetWFont(int id);
void RemoveWFonts();
void RemoveWLBFonts();
//Wrapped from JSoundSystem. TODO: Privatize.
JMusic * ssLoadMusic(const char *fileName);
@@ -210,7 +206,7 @@ private:
WCache<WCachedSample,JSample> sampleWCache;
WCache<WCachedParticles,hgeParticleSystemInfo> psiWCache;
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
typedef std::map<std::string, WManagedQuad> ManagedQuadMap;
ManagedQuadMap mManagedQuads;
typedef std::map<int, std::string> IDLookupMap;
@@ -219,10 +215,10 @@ private:
//Statistics of record.
unsigned int lastTime;
int lastError;
vector<WFont *> mWFontList;
map<string, int> mWFontMap;
vector<WLBFont *> mWLBFontList;
map<string, int> mWLBFontMap;
typedef std::map<int, WFont*> FontMap;
FontMap mWFontMap;
std::string mFontFileExtension;
};
extern WResourceManager resources;