Currently I'm using 2 static global object for each system + a static get method.
static AssetManager * g_pAssetManager = NULL;
static AssetDestructor g_AssetManagerDestructor; // omfg I could have used boost's shared ptr to remove this class...
static AssetManager * const AssetManager::Get();
On Get() I'm checking if g_pAssetManager = NULL and allocate it. Then I return the ptr;
g_AssetManagerDestructor just check if g_pAssetManager is different than NULL and delete it;
However some systems are using another systems in their destruction process and this can cause runtime failure(destory A.destroy B using A's methods)
Any ideas how I can keep these sytems so I can control their destruction order?
(I have tried something with the resource cache already. To save some headaches and saved the get method, but I moved the global pointer into the engine app object. So it is actually doing:
[source lang="cpp"]static ResourceCashe * const ResourceCache::Get()
{
return RandomEngineApp::Get()->GetResCache();
}[/source]
Any suggestions? I've got poor design pattern knowledge(only factories, I've heard of singleton pattern but I'm not really sure if I'm using it )