surface.DrawText

From Garry's Mod
Revision as of 14:27, 12 May 2019 by Robotboy655 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 surface.DrawText( )

Contents

Description

Draw the specified text on the screen, using the previously set position, font and color.

NOTE

This function does not handle newlines properly

NOTE

This is a rendering function that requires a 2D rendering context.
This means that it will only work in hooks with a 2D rendering context.

Arguments

string text

The text to be rendered.

Examples

Example

Draws 'Hello World' on the screen. All functions in this example must be called for the draw to work flawlessly.

hook.Add( "HUDPaint", "drawsometext", function()
	surface.SetFont( "Default" )
	surface.SetTextColor( 255, 255, 255 )
	surface.SetTextPos( 128, 128 ) 
	surface.DrawText( "Hello World" )
end )


Personal tools
Navigation