Game Development Reference
In-Depth Information
Figure 7-4 . The simple SKLabelNode at the top center of the scene
The reason I moved the label to the top of the scene was so you can more easily see how
changing the vertical alignment affects the node's presentation.
The SKLabelNode property you use to change the vertical alignment is verticalA-
lignmentMode . There are four values you can set this property to, and they are defined
by the SKLabelVerticalAlignmentMode enum .
The first option, SKLabelVerticalAlignmentMode.Baseline , is the default
value and positions the text so that the font's baseline is on the node's origin. You already
saw an example of this option in Figure 7-4 when verticalAlignmentMode was not
set, which resulted in the use of the default value SKLabelVerticalAlign-
mentMode.Baseline .
The second option is the SKLabelVerticalAlignmentMode enum value SKLa-
belVerticalAlignmentMode.Center , which is used to center the text vertically
on the node's origin. To see how the value changes the text layout, add the following line
Search WWH ::




Custom Search