This is a state machine that works well and doesn't afraid of anything.
Demo includes source code, an unfinished options dialog and sydney.mdl and Doxygen for CStateSys.h.
Comments are accepted.
DOWNLOAD
CStateSys
Mine is pretty simple. It is a better version of the state machine I used in two of the demo applications of my IrrODE wrapper (IrrOdeCar, IrrOdeMarble), with a few more things in mind. I think I'll put it online here as soon as I got around to create something more than the switch-some-guis-test
. But still ... it's very simple.
I shared some state machine code a while back. You can find it here.
Who cleans up the memory allocated here? As far as I can tell, the states do not register themselves with the manager or set themselves as the current state, so they are probably leaks.
Code: Select all
if(event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED)
{
if(name == "Quit")
CQuitState* quitState = new CQuitState(manager, this);
else if(name == "Broken Options")
COptionsState* optionsState = new COptionsState(manager, this);
}
That was a bug that I fixed, I'm working on a more impressive tech demo. Just recompile.Ion Dune wrote:I think this state machine is a pretty cool guy. eh kills aleins
Always nice to see 4chan on irrlicht. But I think "works well" is a bit of a stretch, considering it crashes when you close the options or quit the application
The second argument is a parent. Once the parent is destroyed those states get destroyed.vitek wrote:I shared some state machine code a while back. You can find it here.
Who cleans up the memory allocated here? As far as I can tell, the states do not register themselves with the manager or set themselves as the current state, so they are probably leaks.Code: Select all
if(event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) { if(name == "Quit") CQuitState* quitState = new CQuitState(manager, this); else if(name == "Broken Options") COptionsState* optionsState = new COptionsState(manager, this); }
