In this chapter, you learn how to create a Visual C++ game called the Lottery Assistant. This application is designed to aid users in creating a list of randomly generated lottery numbers. Players have control over several graphical options for the game, including the font size used to display game output and the game window's background color.
The range of numbers that a lottery game should display depends on the type of game being played. Some games, for example, might require the selection of numbers in the range of 1 to 36, whereas others might set the range as 1 to 50. Lottery games also vary in the number of lottery numbers (picks) required to play. Some games, for instance, require 5 numbers, whereas others might require 7 or even 10 numbers. The Lottery Assistant is designed to deal with these variations. It allows players to specify the following:
The range of numbers to select from
The number of lottery numbers required to play the lottery game
The number of sets of lottery numbers they want generated
To play the game, the player first provides this information in text fields. Then, to make the game run, the player clicks on the appropriate menu item. Figures 4.1 through 4.6 illustrate the overall flow of the Lottery Assistant game.
Figure 4.1: The Lottery Assistant game begins by collecting player input.
Figure 4.2: Players control the game using its menu system.
Figure 4.3: Up to 10 sets of lottery numbers can be generated at a time.
Figure 4.4: Players can configure the game's background color.
Figure 4.5: Using the Font Size submenu, the user can specify the font size used to display lottery numbers.
Figure 4.6: By clicking on the About menu item located on the Help menu, players can learn more about the game.
As a result of creating this game, you'll have learned how to create your own menu system, complete with menus, menu items, submenus, access keys, and shortcuts.