joshka
Member
|
States in class
Hi:
I want create states in class, eg: intro, menu, game.... but i can't create de Object State in my class.
I have the following class:
Code:
class Intro{
public:
Bool init();
Bool update();
void draw();
void shutdown();
State StateIntro;
protected:
Intro(){
StateIntro(&Intro::update, &Intro::draw, &Intro::init, &Intro::shutdown);
}
~Intro(){
}
Intro(const Intro & );
Intro &operator= (const Intro & );
};
but this example doesn't compile, how can i create the object State?
Thank you!
PD: Im former of DaveTs dev team
(This post was last modified: 11-06-2011 11:25 PM by joshka.)
|
|
11-06-2011 11:17 PM |
|
fatcoder
Member
|
RE: States in class
Take a look at the Simple Project in the Projects tutorials folder for an example of using states.
|
|
11-07-2011 12:45 AM |
|
joshka
Member
|
RE: States in class
i looked the SimpleProject tutorial but i want handle the states through classes (singleton), then i need create the State object in my class, but i can't create it.
Sorry i'm beginner in c++
|
|
11-07-2011 08:23 AM |
|
fatcoder
Member
|
RE: States in class
If you are weak at c++, then I would suggest googling c++ singletons and find a simple exmaple that you can build off.
|
|
11-07-2011 10:45 AM |
|
joshka
Member
|
RE: States in class
i have the singleton class, but i have omitted code. how can i initialize the state object in my class??
|
|
11-07-2011 12:34 PM |
|