|
From: <axl...@us...> - 2008-12-31 05:04:10
|
Revision: 126
http://hgengine.svn.sourceforge.net/hgengine/?rev=126&view=rev
Author: axlecrusher
Date: 2008-12-31 05:04:06 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
don't give access to the factory's locate function, go through the factory's generate
Modified Paths:
--------------
Mercury2/src/MercuryAsset.h
Mercury2/src/Texture.cpp
Mercury2/src/Texture.h
Modified: Mercury2/src/MercuryAsset.h
===================================================================
--- Mercury2/src/MercuryAsset.h 2008-12-31 04:52:33 UTC (rev 125)
+++ Mercury2/src/MercuryAsset.h 2008-12-31 05:04:06 UTC (rev 126)
@@ -30,10 +30,10 @@
void AddAssetInstance(const MString& key, MercuryAsset* asset);
void RemoveAssetInstance(const MString& key);
-
+
+ private:
MercuryAsset* LocateAsset( const MString& key );
- private:
std::list< std::pair< MString, Callback0R< MAutoPtr<MercuryAsset> > > > m_factoryCallbacks;
static std::map<MString, MercuryAsset*> m_assetInstances;
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2008-12-31 04:52:33 UTC (rev 125)
+++ Mercury2/src/Texture.cpp 2008-12-31 05:04:06 UTC (rev 126)
@@ -136,11 +136,12 @@
return new Texture();
}
-Texture* Texture::LoadFromFile(const MString& path)
+MAutoPtr< Texture > Texture::LoadFromFile(const MString& path)
{
- Texture *t = (Texture*)AssetFactory::GetInstance().LocateAsset("TEXTURE" + path);
- if (!t) t = Generate();
- t->LoadImage( path );
+ MAutoPtr< MercuryAsset > t( AssetFactory::GetInstance().Generate("Texture", path) );
+ Texture *a = (Texture*)&(*t);
+ a->LoadImage( path );
+ return a;
}
bool Texture::m_initTextureSuccess = false;
Modified: Mercury2/src/Texture.h
===================================================================
--- Mercury2/src/Texture.h 2008-12-31 04:52:33 UTC (rev 125)
+++ Mercury2/src/Texture.h 2008-12-31 05:04:06 UTC (rev 126)
@@ -22,7 +22,7 @@
inline static unsigned short NumberActiveTextures() { return m_activeTextures; }
static Texture* Generate();
- static Texture* LoadFromFile(const MString& path);
+ static MAutoPtr< Texture > LoadFromFile(const MString& path);
private:
void LoadImage(const MString& path);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|