draw_set_halign

Aligns any subsequently drawn text horizontally.

Syntax:

GML Code Example

draw_set_halign(halign);


Argument Description
halign Horizontal alignment.


Returns: N/A


Description

This function is used to align text along the horizontal axis and changing the horizontal alignment will change the position and direction in which all further text is drawn with the default value being fa_left. The following constants are accepted:

Constant Alignment
fa_left
fa_center
fa_right


Example:

GML Code Example

draw_set_halign(fa_left);
 draw_text(100, 32, "Score: " + string(score));
 draw_set_halign(fa_right);
 draw_text(room_width - 100, 32, "Health: " + string(health));
 

The above code will draw two strings on the same line, with the score being left-hand aligned and the health being right-hand aligned.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here