Legacy:Font/drawText: Difference between revisions
Jump to navigation
Jump to search
Created page with "{{subst::functemp}}" |
m →Examples: Edited col width a little |
||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | Draw (write) a line of text on the screen using the specified font. | ||
__TOC__ | |||
==Usage== | |||
{{Usage|object=Font|func=drawText|params=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. | |||
==Examples== | |||
{{template:col-begin}} | |||
{{template:col-break|width=30%}} | |||
<syntaxhighlight> | |||
var font = GetSystemFont(); | |||
font.drawText(10, 10, "I am a line of text."); | |||
FlipScreen(); | |||
GetKey(); | |||
</syntaxhighlight> | |||
{{template:col-break}} | |||
<syntaxhighlight> | |||
//Load the font to use | |||
//Draw it | |||
//Now display it on the screen | |||
//Now wait for user interaction | |||
</syntaxhighlight> | |||
{{template:col-end}} | |||
==Notes== | |||
* 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== | |||
* [[API:GetSystemFont|GetSystemFont]]() | |||
* [[API:Font|Font]]() | |||
* [[Font.drawTextBox]]() | |||
* [[Font.drawZoomedText]]() | |||
* [[API:FlipScreen|FlipScreen]]() | |||
* [[API:GetKey|GetKey]]() | |||
{{API:Font/navbox}} | |||
Latest revision as of 12:00, 7 August 2017
Draw (write) a line of text on the screen using the specified font.
Usage
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.
Examples
var font = GetSystemFont();
font.drawText(10, 10, "I am a line of text.");
FlipScreen();
GetKey(); |
//Load the font to use
//Draw it
//Now display it on the screen
//Now wait for user interaction |
Notes
- 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
- FlipScreen()
- GetKey()