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

@@ -19,7 +19,6 @@ const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024;
extern bool neofont;
int idCounter = OTHERS_OFFSET;
WResourceManager resources;
namespace
{
@@ -28,6 +27,8 @@ namespace
const std::string kExtension_font(".font");
}
WResourceManager* WResourceManager::sInstance = NULL;
int WResourceManager::RetrieveError()
{
return lastError;
@@ -46,7 +47,7 @@ bool WResourceManager::RemoveOldest()
void WResourceManager::DebugRender()
{
JRenderer* renderer = JRenderer::GetInstance();
WFont * font = resources.GetWFont(Fonts::MAIN_FONT);
WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
font->SetColor(ARGB(255,255,255,255));
if (!font || !renderer) return;
@@ -1198,7 +1199,7 @@ cacheItem* WCache<cacheItem, cacheActual>::Retrieve(int id, const string& filena
//Unlink the managed resource from the cache.
UnlinkCache(tc);
//Post it in managed resources.
//Post it in managed WResourceManager::Instance()->
managed[makeID(id, filename, submode)] = tc;
tc->deadbolt();
}