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, ...
Get Beginning 3D Game Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.