Archived

This topic is now archived and is closed to further replies.

central texturemanagment

This topic is 5670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! For about 2 hours i am working on a managementsystem for textures. So far i have one big problem! If i make a class CTextrueMangement an then i use it in my engine like Engine->TextrueMangement->..., how could i use it e.g. for a particlesystem? Here a part form the engine's header:
class CEngine
{
private:

protected:
	CTimer	*timer;

public:
	void Init (void);
	void EngineStart (const char* t, int w, int h, int b, bool f);
	void EngineStop (void);
	// e.g. for Gui
	void 2DStart (void);
	void 2DStop (void);

	CSoundManager	*Sound;
	CTextureManager *TextureManager;
	...
};
 
Now i can use it in the Enige like... Engine->TextrueMangement->... But how do i access the same Manager from other parts of the Engine (e.g. particle system, terrainloading,...)?? Thx, Austrian Coder [edited by - Austrian Coder on June 3, 2002 8:18:41 AM]

Share this post


Link to post
Share on other sites
You could make it a singleton. There are two articles on the front page of Gamedev just now about that topic:

One
Two

After this you can simply say "TextureManager::instance()" to get the texture manager from anywhere. You wouldn''t need to store any pointers to it anywhere (although you could for convenience).

Share this post


Link to post
Share on other sites