Game Development Reference
In-Depth Information
Chapter 13,
and you should remember the Process Manager from
Chapter 7, Controlling the Main Loop.
A screen element is anything that draws and accepts input. It could be anything from
a button to your rendered 3D world. In Chapter 15,
Game Audio,
we create a screen element that can draw 3D objects and accept mouse and keyboard
input to move the camera through the 3D world. In this chapter, we
3D Vertex and Pixel Shaders,
'
ll concentrate on
user interface components like buttons and dialog boxes.
Screen elements can be hierarchical
for example, a dialog box can have buttons
attached to it. A Windows-style scroll bar has lots of moving parts: a background,
two buttons, and a dynamically sized, movable bit in the middle to represent where
the scrolled data is positioned and how much data is represented off screen.
Screen elements in various configurations create the user interface for your game,
such as a menu, inventory screen, scoreboard, radar, or dialog box. Some run on
top of the main game screen, such as a radar or minimap, but others might
completely overlay the main view and even pause the game, such as an options
screen. Throughout this chapter, I
ll generally refer to a screen as something that
contains screen elements and a control as the leaf nodes of this hierarchy. In addition
to acting as a container for controls, screens parse user input messages from the
application layer and translate them into game messages.
'
Screens Need Transition Management
If your game has multiple screens, and even simple games have many, it
s wise
to manage them and the transitions between them in a high-level API. This
might seem a little strange to Windows programmers, but it
'
s a little like
programming multiple applications for the same window, and you can freely
move from one screen to another by selecting the right controls.
'
If your screens are fairly small
consider preloading them. Any
transitions that happen will be blazingly fast, and players like responsive
transitions.
memory-wise,
If your screens have tons of controls, graphics, and sounds, you
won
t necessarily be able to preload them because of memory constraints, but
you might consider loading a small transition screen to give your players
something to look at while you load your bigger screens. Lots of console games do this, and they usually
display a bit of the next mission in the background while a nice animation plays showing the load progress.
The animation during the load is important, because all console manufacturers require animations during
loading screens beyond some small threshold, such as 10 seconds. They do this not to make your job harder,
but they want to communicate to the player that something is still happening in the background.
'
Lots of kids
games and mass-market titles use a screen architecture like the one shown
in Figure 10.1 throughout the entire game. When the right controls are activated in the
right order, the current screen is replaced by a new one with different controls.
'
 
Search WWH ::




Custom Search