Game Development Reference
In-Depth Information
Value Definition
IW_GX_FONT_RIGHTTOLEFT_F  Draws characters from right to left. Useful for
drawing languages such as Arabic.
IW_GX_FONT_NOWORDSPLIT_F  Wraps text at the end of words. A word can
overlap the end of the rectangle boundary, but the
next word will start on the next line.
Flags can be cleared again using IwGxFontClearFlags .
We can also specify whether text is drawn left aligned, right aligned, or centered in
the rectangular bounding area using the function IwGxFontSetAlignmentHor , which
takes one of the following values:
Value
Definition
IW_GX_FONT_ALIGN_LEFT
Aligns text to the left of the bounding box.
IW_GX_FONT_ALIGN_CENTRE
Centres text horizontally in the bounding box.
IW_GX_FONT_ALIGN_RIGHT
Aligns text to the right edge of the bounding box.
IW_GX_FONT_ALIGN_
PARAGRAPH
Performs left or right alignment, as defined by
the device's localization settings.
We can do similar alignments vertically as well using IwGxFontSelAlignmentVer
with one of these values:
Value
Definition
IW_GX_FONT_ALIGN_TOP
Text is drawn so that the top line of text touches
the top of the bounding box.
IW_GX_FONT_ALIGN_MIDDLE
Text is centered vertically in the bounding box.
IW_GX_FONT_ALIGN_BOTTOM
Text is drawn so the bottom of the last line of
text touches the bottom of the bounding box.
Changing font size at runtime
Sometimes it is desirable to be able to animate text by making changes in its size. For
example, in a shooting game the score awarded for killing an enemy might appear at
the position of the enemy then gradually grow larger and fade out.
The function IwGxFontSetScale enables us to do this. It takes two parameters so the
font can be scaled by different amounts, both horizontally and vertically. The scaling
factors are passed in as fixed point values, with IW_GEOM_ONE indicating a scaling
factor of 1 and therefore no change in size.
Search WWH ::




Custom Search