Looking Behind a Splash Screen


Although you could certainly dream up a complex approach to creating a splash screen, the simplest way to carry out the task is to simply create a bitmap image for the screen and then display it on the game screen before the game begins. The image for a splash screen can be large enough to fill the entire game screen or it can be smaller and displayed on top of the existing background for the game. The size of the splash screen for your own games is entirely up to you. However, for the Space Out game, I opted to create a splash screen that is smaller than the game screen. Figure 22.1 shows how the splash screen image is designed to overlay on top of the game background in the Space Out game.

Figure 22.1. The splash screen image in the Space Out game is designed to be displayed over the background for the game.

graphics/22fig01.gif

As you can see in the figure, there really isn't anything magical about displaying a splash screen, especially in the Space Out game. The only slightly tricky aspect of adding a splash screen to a game is establishing a separate mode of the game for the splash screen. For example, all the games you've created in the book are always in one of two modes, "game over" or "game not over." These two modes are directly controlled by the _bGameOver global variable, which has one of two Boolean values, TRUE or FALSE . Although you could associate the splash screen with a game being over, it is more accurate to give it a mode of its own.

Giving a splash screen a mode of its own basically means adding a global variable that indicates whether the splash screen should be displayed. This makes sense because you probably don't want to display the splash screen once a game has started and ended. In other words, the splash screen is only shown when the game first starts, and then it never appears again. You could create a splash screen that is shown in between games, but that's a role better suited to demo mode, which you learn about in the next hour .



Sams Teach Yourself Game Programming in 24 Hours
Sams Teach Yourself Game Programming in 24 Hours
ISBN: 067232461X
EAN: 2147483647
Year: 2002
Pages: 271

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net