Original Post
Hi all, I'm designing my game engine and this is something that keeps popping up. I currently have a CTexture class that encapsulates texture-related functions (loading, binding, unloading) and a CTextureManager class that releases the textures at application termination. The texture manager is held by the graphics engine class. Now, if I want to load textures, how should I go about doing it? For example, my window class wants to access a texture for the window skin. However, the class hierarchy does not allow for passing a pointer (to the texture manager) to the window's loading function. My class hierarchy looks like this: CEngine -CGraphicsEngine --CTextureManager ---CTexture -CUserInterface --CWindowFactory (creates CWindow) --CWindow Similarly, I have a map editor window class (which extends CWindow) that needs access to the map/scenegraph class. How can I pass a pointer/reference, to the map class, to the map editor window? The straightforward workaround is to make both the texture manager and map class singletons. However, I know that not every piece of code will need to load textures, or access the map. So I just wanted to run this by you, am I missing something, or should I reconsider my class hierarchy and how? Thanks in advance