Jump to content
  • Advertisement

Archived

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

supagu

circular header including?

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

here is the situtaion: I have a render manager, and a world manager. 1. render manager needs to know about the world, the render manager tells the world what cells to render 2. the world needs to know about the render manager to draw the polys (for vertex caching/batching) Another situation i have is: Render manager tells the world what cells to render, the cells then tell each mesh in its area to be rendered, then each mesh needs to know about the render manager to get the camera used in some areas such as for sprite meshes. here are 2 exmaples of circular includes, and i dont know what to do to try to get around it any ideas would be very helpful, thanks

Share this post


Link to post
Share on other sites
Advertisement
One thing you can do is forward declarations:

// In render.h

class world;

class render
{
//stuff
};


// In render.cpp
#include "render.h"
#include "world.h"


// In world.h

class render;

class world
{
// stuff
};


// In world.cpp
#include "world.h"
#include "render.h"



hope this helps

Share this post


Link to post
Share on other sites
If you must... then use a forward declaration.


class RenderManager; // just tells compiler "this class exists"

class WorldManager
{
RenderManager *pRender;
};

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!