Game Development Reference
In-Depth Information
Tovalidate thatlabelsaredrawingandaligningproperly,wecandrawlinesaroundthedif-
ferent parts of a label. First we should draw an outline over the label's maximum size, this
is the label's m_rectangle field. Next we should draw two lines that run across the center
horizontally and vertically of the label, this will aid a lot when we verify alignment. Fin-
ally we can draw lines around the text extents themselves, with these lines enabled we can
validate or debug the labels' positioning and alignment.
Figure 54 - Using debug lines we can validate or debug any label's position and alignment.
4.3.5 Buttons
Abuttonisoneofthemostcommondevicesfortheplayertointeractwiththegame.There
are many different types of buttons, but the majority share a common set of features. We
will start by focusing on the core functionality that most buttons should have. A button is a
userinterface element thathasastate,itsdefaultstateiswhenthebuttonisnotpressedand
ready for input. It can be active, or selected, which could mean the presence of some input
device is over it, like a mouse cursor. When input is received, the button is pressed and
at some point it will be released. Some buttons may also have some additional properties,
such as being checked or disabled to prevent any input from the player.
Search WWH ::




Custom Search