Well, a new version got done today. It uses the same principles as the 2.0, but much cleaner, and in a spiffier manner.
http://prdownloads.sourceforge.net/cent ... p?download
Since i didn't get the chance to document it (and hardly any code comments

), here is a short tutorial on how to use it.
=============================================
In your main function, create an instance of SSSF::GameEngine;
Code: Select all
SSSF::GameEngine* engine = new SSSF::GameEngine();
For each gamestate you would like to create, create a child class of GameState
Code: Select all
class GS_Server_Brower : public SSSF::GameState
A test bed game state is included.
in each of your GameState classes, add the following memebers
- bool Update(float timeSinceLastFrame);
- bool OnKeyEvent(float tslf);
- bool OnMouseEvent(float tslf);
- bool Create();
- bool Destroy();
- bool Hide();
Update(float tslf)
Does what it says, it updates the game state. Include any parts that need updating here.
Param: time since the last frame
OnKeyEvent(float tslf)
Here you process key events, although you could do it in Update, OnMouseEvent, wherever, this is the function that gets called
Param: time since last frame
OnMouseEvent(float tslf)
Same as above, but w/ mouse events
Create()
Here you create the items needed by the game state. Use this function instead of the constructor, so you can restore states.
See: GS_TestBed
Destroy()
Does nothing as of now
Hide()
Hides the game state items, but keeps them in memory for future reference. If you want to remove the game state from memory, call Destroy right before you switch states.
In your constructor, or after you create an instance of a game state, to register it with the state_handler (GameEngine), call
Code: Select all
GameEngine::AddState(GameState* state);
ex.
States::GS_TestBed* state = new States::GS_TestBed("GS_TestBed", engine);
engine->AddState(state);
To switch to a different state, call the GameEngine::ChangeState function with the string handle of the game state you gave to ur state.
ex.
Code: Select all
...GS_TestBed("GS_TestBed", engine)...
engine->ChangeState("GS_TestBed");
This allows for easy extension using scripts. For example, using python (once bindings are made) (please don't mind any code errors, my python is a bit shakey

)
Code: Select all
class GS_Main_Menu(GameState):
#Functions go here
GS_Main_Menu menu("Main_Menu", engine);
engine.AddState(menu)
engine.ChangeState("Main_Menu");
This way, you can effectively create all of your gamestates in scripting, while keeping your ogre init and base code in c++.
Hope you like it, and expect mroe upgrades at random points.
P.S. The reason for the name change is that it is now part of the game engine i'm making, codename SnowStorm.
Enjoy!