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

Finishing Up

Figure 9.1 has some text being rendered that you haven't added yet. Obviously, you want the user to know the current state of the game and how close he is to winning (or losing)! You need to declare a new font variable to render this text, as well as one for the quit screen you just created:

// The main game font
private Direct3D.Font gameFont = null;
// The UI Screen for quitting
private QuitScreen quitScreen = null;

Naturally, you must also create these objects. In your OnCreateDevice method directly before the OnResetDevice call, add the following code to create these objects:

 gameFont = new Direct3D.Font(device, new System.Drawing.Font(this.Font.Name, 28.0f)); // Create the screen for the UI Screen quitScreen = new QuitScreen(device, ...

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