Difference between revisions of "Legacy:Font/drawText"

From Spherical
Jump to: navigation, search
(See also)
(added navbox)
Line 45: Line 45:
* [[API:FlipScreen|FlipScreen]]()
* [[API:FlipScreen|FlipScreen]]()
* [[API:GetKey|GetKey]]()
* [[API:GetKey|GetKey]]()

Revision as of 21:41, 24 June 2013

Draw (write) a line of text on the screen using the specified font.


Font.drawText(x, y, text);

  • x Integer. The x position on the screen where the text starts drawing.
  • y Integer. The y position of the text on the screen.
  • text String. The text to display.


var font = GetSystemFont();
font.drawText(10, 10, "I am a line of text.");


//Load the font to use
//Draw it

//Now display it on the screen
//Now wait for user interaction


  • Using \n for new lines doesn't work with this function. drawText() is meant purely for drawing single line of text.
  • The line width is infinite, so you can easily go past the screen width if your line is too long.

See also