Game Development Reference
In-Depth Information
public void Render()
{
throw new NotImplementedException();
}
#endregion
}
We're not implementing the splash screen functionality at the moment; there-
fore, the exceptions can be removed to make testing the code easier. Something
like the following will be easier to work with.
public void Update(double elapsedTime)
{
System.Console.WriteLine("Updating Splash");
}
public void Render()
{
System.Console.WriteLine("Rendering Splash");
}
That's one state—the rest can be created in much the same way. Create a few of
the states for practice.
Once the states are made, the code to handle these states is quite simple. To
follow the rest of the code, you should create the TitleMenuState . It doesn't
need any functionality. If it just prints out its name in the render and update
functions, then that's great. If you're still not sure how to create it then you can
check the code on the CD.
Here's an example of how the states might be used in the Form.cs file.
StateSystem _system = new StateSystem();
public Form1()
{
// Add all the states that will be used.
_system.AddState("splash", new SplashScreenState(_system));
_system.AddState("title_menu", new TitleMenuState());
// Select the start state
_system.ChangeState("splash");
 
Search WWH ::




Custom Search