draw_text

Draw a string at a given position.

Syntax:

GML Code Example

draw_text(x, y, string);


Argument Description
x The x coordinate of the drawn string.
y The y coordinate of the drawn string.
string The string to draw.


Returns: N/A


Description

With this function you can draw any string at any position within the room (for drawing real numbers you should use the string function to convert them into text). To combine strings you can use + (see example below), you can also use # to add a line break to the string (should you need to display the # symbol, then you should precede it with a backslash like this "this will draw a \#") and you can also draw quotations by using inverted commas (for example 'I said "Hello"...'). The colour of the text and the alpha are governed by the current base alpha and colour values as set by draw_set_alpha and draw_set_colour

NOTE: The actual position of the text will be influenced by the alignment values set by draw_set_halign and draw_set_valign.


Example:

GML Code Example

draw_text(x, y, "Hello, " + global.Name + "!#I hope you are well!");

The above code will draw a string at the instance x/y position, which will use the string stored in the global variable "Name" and split it over two lines.





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