Draws a string at a given position with a specific spacing and within a limited area.


GML Code Example

draw_text_ext(x, y, string, sep, w);

Argument Description
x The x coordinate of the drawn string.
y The y coordinate of the drawn string.
string The string to draw.
sep The distance in pixels between lines of text.
w The maximum width in pixels of the string before a line break.

Returns: N/A


This function will draw text in a similar way to draw_text only now you can set the space between each line of text - should the text occupy more than one line - and limit the width (in pixels) of the string per line so that should any line exceed this value, GameMaker: Studio will automatically split the text to the next line. A value of -1 for the line separation argument will default to a separation based on the height of the "M" character in the chosen font.


GML Code Example

draw_text_ext(100, 50, keyboard_string, 3, 300);

The above code will draw whatever text the user types into the keyboard, splitting it onto new lines every time the string length for that line exceeds 300 pixels. the code will also maintain a separation of 3 pixels between lines should this occur.

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