fillText

fillText( string, x, y, isCentred=false )

Draws the given String, filled, to the screen at the x/y location. This will draw using the current font, which can be set using 'setFont'.

Like similar functions, 'isCentred' allows you to state if the x/y location is the top-left corner (when false), or the middle of the string (when true).

Multi-line text is supported through including the end of line character, "\n", in a string.

onEachFrame() do
    fill( :grey )
    
    fillText( "Hello World!", 10, 10 )
    fillText( "Here is a piece of\nmultiline text", 10, 80 )
end

Note that how this is rendered is heavily dependent on the browser, and the OS. You should never expect text to look exactly the same on all machines.

fillText( string, x, y, xAlign, yAlign )

The same function, but with x and y axis alignment parameters. See the article on How Alignment Works for more details.

See also

How Alignment Works - setFont - drawText