Game Development Reference
In-Depth Information
CCLabelTTF Properties
The button's CCLabelTTF properties are the same as those for a regular Label TTF node.
The image in Figure 6-4 does not show the Font Effects section; this will be discussed in
detail in the “Labels & Localization” chapter.
Figure 6-4 . CCLabelTTF properties
The label's Font name , Font size , and Alignment properties should be self-explanatory.
Clicking the UI button for Font size as well as the padding properties prevents these prop-
erties from scaling by a factor of 2 when running on iPad, effectively keeping the button
the same size as on an iPhone rather than scaling it up. You can give this a try and then
toggle screen sizes with Cmd+1 and Cmd+2 to see the effect. But revert it back to point
scaling by clicking the dot icon as shown in Figure 6-4 .
The Horizontal padding and Vertical padding settings allow you to declare the button's
label to be twice this many points wider and higher. The horizontal padding of 20 shown
in Figure 6-4 makes the label 40 points wider in total, which will also expand the button's
background image accordingly. Padding is mainly used to control how far the label is in-
set from the background image's borders.
In this case, set Horizontal padding from its default 10 to 20 to ensure that the label's let-
ters are printed entirely on the solid gray area of the background image rather than drawn
over or close to the background image's unevenly shaped borders.
Assigning the Button Selector
On the Item Code Connections tab for the button, enter shouldPauseGame as the button's
Selector in the CCControl section. See Figure 6-5 for reference. The Target drop-down
menu should be set to Document root .
Search WWH ::




Custom Search