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:
@@ -18,7 +18,7 @@ OptionItem::OptionItem( int _id, string _displayValue): WGuiItem(_displayValue)
|
||||
|
||||
//OptionInteger
|
||||
void OptionInteger::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -68,7 +68,7 @@ void OptionSelect::Entering(JButton key){
|
||||
}
|
||||
|
||||
void OptionSelect::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
@@ -165,7 +165,7 @@ void OptionProfile::populate(){
|
||||
|
||||
void OptionProfile::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetScale(1);
|
||||
int spacing = 2+(int)mFont->GetHeight();
|
||||
|
||||
@@ -426,7 +426,7 @@ void OptionTheme::Render(){
|
||||
renderer->RenderQuad(q,x, y,0,scale,scale);
|
||||
}
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
||||
mFont->DrawString(buf, x + 2, y + 2);
|
||||
if(bChecked && author.size()){
|
||||
@@ -464,7 +464,7 @@ OptionKey::OptionKey(GameStateOptions* g, LocalKeySym from, JButton to) : WGuiIt
|
||||
|
||||
void OptionKey::Update(float dt) { if (btnMenu) btnMenu->Update(dt); }
|
||||
void OptionKey::Render() {
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -514,7 +514,7 @@ void OptionKey::KeyPressed(LocalKeySym key) {
|
||||
g->UngrabKeyboard(this);
|
||||
grabbed = false;
|
||||
|
||||
btnMenu = NEW SimpleMenu(0, this, Constants::MENU_FONT, 80, 10);
|
||||
btnMenu = NEW SimpleMenu(0, this, Fonts::MENU_FONT, 80, 10);
|
||||
for (int i = sizeof(btnList) / sizeof(btnList[0]) - 1; i >= 0; --i) {
|
||||
const KeyRep& rep = translateKey(btnList[i]);
|
||||
btnMenu->Add(i, rep.first.c_str());
|
||||
@@ -524,7 +524,7 @@ bool OptionKey::isModal() { return grabbed || btnMenu; }
|
||||
void OptionKey::Overlay()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(ARGB(255, 0, 0, 0));
|
||||
if (grabbed) {
|
||||
static const int x = 30, y = 45;
|
||||
|
||||
Reference in New Issue
Block a user