Hello, this may be a big post so please bear with me.
I am in progress of creating a small maze type game making use of Direct3D and PhysX using C++.
I'm a little concerned about with the way I have structured my game though.
Right now I have a class call World. This has functions such as CreateCube, CreateSphere etc.
My Graphics class (using Direct3D), has functions such as CreateCube, CreateSphere, LoadShader, LoadTexture etc. Each of which create an id. The id is created via:
m_entityVector.push_back(newCube);
id = (unsigned short)m_entityVector.size()-1;
where m_entityVector is defined as a member:
std::vector<IGfxEntity*> m_entityVector;
and IGfxEntity is a base class to all my objects (Cube, Sphere, Teapot etc.)
My Physics class (using PhysX), works is a similar way with functions like CreateCube, CreateSphere etc. and these also create an id for each object.
My World class uses both Graphics and Physics class (as members), and when World's CreateCube member function is called, it calls both the functions in Graphics+Physics. And stores their id's in world's std::vector<IWorldEntity*> m_entityVector (class IWorldEntity is a base class), whilst creating an id of it's own.
If I want to change an objects position (or something else) I would used function:
SetTranslate(int id, float x, float y, float z);
I feel that this structure for a game is not that good, and IWorldEntity also needs pointers to Graphics and Physics class which is provided by World.
I was hoping for some feedback on it, or if anyone knows of good insite or a good website to give advice on game structure?
Thank you.