hi
my app structure is currently looking like this:
testApp
- appCV
- sceneManager
– baseScene
So in testApp I’ve a class called appCv and a sceneManager class.
I then have a baseScene class, then various scenes, lets say sceneSnow, sceneSun that extend baseScene
class sceneSnow: public baseScene{
in sceneManager.h I have:
// at top
#include "sceneSnow.h"
#include "sceneSun.h"
// in public
baseScene ** scenes;
in sceneManager.cpp setup i have:
scenes = new baseScene*[2];
scenes[0] = new sceneSnow();
scenes[1] = new sceneSun();
for(int i=0; i<2; i++){
scenes[i]->init();
}
- For those in the know is this the best way to go about it?
Yes I could just have:
sceneSnow snow;
sceneSun sun;
but that becomes more problematic later on, and prefer them in an array so I can do
scenes[currentScene]->draw()
- From within my scene, I need to be able to call return functions in appCv.
For simplicity, am I better off in testApp update just passing values into sceneManager to copy them into each scene?
Anyway, at the top of baseScene.h I’ve got
// at top
class sceneManager;
// in public
void setParent(sceneManager * p){ parent = p;}
sceneManager * parent;
And at the top of baseScene.cpp I’ve got #include “sceneManager.h”
However this isn’t working. Is it the way I am using the pointers to classes? The compiler is telling me in baseScene.cpp it can’t find sceneManager.h, although I know this way of communicating with the parent should work.
Any ideas would be greatly appreciated.
Thanks