Another change that looks bigger than it is: changed out the global extern WResourceManager to a real singleton. This means that it's no longer being init'ed at static initialization time, and we can debug construction/destruction properly; it's also safer in a multithreaded context.

This commit is contained in:
wrenczes@gmail.com
2010-12-01 08:22:17 +00:00
parent aa6aa20ba5
commit 65e38b0694
53 changed files with 369 additions and 346 deletions

View File

@@ -371,7 +371,7 @@ void WFBFont::DrawString(const char *s, float x, float y, int align, float leftO
{
// tricky: the single byte font is always mFontID + kSingleByteFontOffset!
// See WResourceManager::InitFonts()
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontID + Fonts::kSingleByteFontOffset);
mFont->SetScale(GetScale());
mFont->SetColor(GetColor());
mFont->DrawString(s, x, y, align, leftOffset, width);
@@ -572,7 +572,7 @@ float WFBFont::GetStringWidth(const char *s) const
}
else
{
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontID + Fonts::kSingleByteFontOffset);
mFont->SetScale(GetScale());
return mFont->GetStringWidth(s);
}
@@ -773,7 +773,7 @@ void WGBKFont::DrawString(const char *s, float x, float y, int align, float left
{
// tricky: the single byte font is always mFontID + kSingleByteFontOffset!
// See WResourceManager::InitFonts()
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontID + Fonts::kSingleByteFontOffset);
mFont->SetScale(GetScale());
mFont->SetColor(GetColor());
mFont->DrawString(s, x, y, align, leftOffset, width);
@@ -993,7 +993,7 @@ float WGBKFont::GetStringWidth(const char *s) const
}
else
{
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontID + Fonts::kSingleByteFontOffset);
mFont->SetScale(GetScale());
return mFont->GetStringWidth(s);
}