Jump to content
  • Advertisement

Archived

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

Jason Z

Class organization question

This topic is 5275 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

I am struggling a bit with how I am organizing my game project and I was wondering if anyone has any input. Here is what I have so far: - The Application class that creates each of the lower modules. - The Renderer and Input classes that are used by the Application. The application also creates the Mesh classes to represent the geometry to be rendered. - A texture manager class and a material manager class are statically declared withing the Renderer. At startup the application creates a Mesh object and tells it to load the vertex and material data from a file. Then the Mesh is supposed to register its material and texture with the manager classes that are resident in the Renderer to eliminate duplicate textures and materials (the Mesh object gets a material and texture ID which would be passed to the renderer during the MeshDraw() function. Here is where the problem arises. The Renderer has the Mesh header #included in it because it needs to know how to access the vertex data. But the Mesh class would have to have the Renderer header #included in it or else it can''t use the manager classes. Am I just thinking about this the wrong way? Is there some very simple solution to this? I have been trying to wrap my mind around this all day and haven''t been able to come up with something simple. Any suggestions? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
you can always use forward delcarations in the header file if you are not instanciating or using the pointers in an inlide function.

// header A
class B;
class A{ B* m_Poiner; };

// header B
class A;
class B{ A* m_Poiner; };

I suggest you to not try to think about design too much and instead try to get things done. If you are having problems with all the C++ features that you don''t know how to handle just give C a try. It will probablly make your life easier.



Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!