draw_text

From ENIGMA

Jump to: navigation, search

This function is part of the function set Drawing text.

Notation

draw_text(x,y,string)

Description

Draws a regular text string with top left corner placed at (x,y) position using the drawing color and alpha.

A # symbol or carriage return chr(13) or linefeed chr(10) are interpreted as newline characters. Note that EDL string settings can allow you to use the \n escape sequence in place of the # symbol.

To change the text alignment you can use draw_set_valign(alignment) and draw_set_halign(alignment) functions.

Parameters

  • x, y: The coordinates to draw the text at. (0,0) indicates the top-left corner of the room.
  • string: The textual string to display.

Return Values

none

Example Call

//Drawing "Hello world!" at the 100,100 position.
draw_text(100,100,"Hello world!");

//Drawing centered "Hello world!" at the mouse position
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(mouse_x,mouse_y,"Hello world!");

//Drawing a numeric value
draw_text(100,100,"You have "+string(lives)+" lives");
//This will draw "You have 5 lives" if variable lives = 5.
Personal tools