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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user