O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Designing the Main Menu

During the end of the last chapter, you wrote the base class for the UI screens you will be creating in this chapter. The first user screen to create is the main menu. Everything in your game spawns from this screen.

Add a new code file to your project called UiScreens.cs, and add the code in Listing 6.1 to the file.

Listing 6.1. The MainUiScreen Class
 /// <summary> /// The main selection screen for the game /// </summary> public class MainUiScreen : UiScreen, IDisposable { private Texture buttonTextures = null; private Texture messageTexture = null; private UiButton newButton = null; private UiButton exitButton = null; // Events public event EventHandler NewGame; public event EventHandler Quit; #region IDisposable Members ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required