a2BoxText

This command will draw text at a particular position on the screen, aligning the text in a box.

  Syntax
a2BoxText fontID, x1, y1, x2, y2, text, halign, valign, wordWrap, color
  Parameters
fontID
Integer
Unique value assigned by the a2CreateFont() command.
x1
Integer
This value specifies the top left corner X coordinate of the text box.
y1
Integer
This value specifies the top left corner Y coordinate of the text box.
x2
Integer
This value specifies the bottom right corner X coordinate of the text box.
y2
Integer
This value specifies the bottom right corner Y coordinate of the text box.
text
String
This is the text string to be displayed.
halign
Integer
Determines the horizontal alignment of the text.
Set to 0 for left-aligned, 1 for centered, or 2 for right-aligned.
valign
Integer
Determines the vertical alignment of the text.
Set to 0 for top-aligned, 1 for centered, or 2 for bottom-aligned.
wordWrap
Boolean
Set to 1 to enable wordwrap, or 0 to disable wordwrap.
color
Integer
This value is a 32 bit integer specifying alpha, red, green, and blue color values for the text.

  Returns

This command does not return a value.

  Description

This command will draw text at a particular position on the screen, aligning the text in a box. Note that the text will not be clipped by the box coordinates.

  Example Code
rem Set up the font
myFont = a2CreateFont("ariel", 20, a2Size_Char(), a2Style_Normal() ,1)

rem Draw a bounding box, so we can see how the command works
a2Box 10, 10, 200, 200, 0x88FFFFFF

rem Set up some variables
a$ = "Now is the time for all quick foxes to jump over their lazy dogs."
valign = 0
halign = 0
wordWrap = 1
color = 0xFFFFFF00

rem Draw the text
a2BoxText myFont, 10, 10, 200, 200, a$, halign, valign, wordWrap, color

WAIT KEY
  See also

a2CreateFont
a2DeleteFont
a2GetLineHeight
a2GetTextWidth
a2Text
Advanced 2D Index
Main Menu