Implementing the Quit Screen
You've already designed two user interface screens in earlier chapters, so this part will be a cakewalk to you, but you must implement this last screen. While the game is being played, you want the user to be asked whether she is sure that she wants to quit if she presses the Escape key. If the user accidentally presses the key, you won't lose all the hard work on the level. Go back to your UiScreen.cs code file and add the class in Listing 9.9.
Listing 9.9. The Quit User Screen
public class QuitScreen : UiScreen, IDisposable { private Texture buttonTextures = null; private Texture messageTexture = null; private UiButton yesButton = null; private UiButton noButton = null; // Events public event EventHandler QuitGame; ... |
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.