Garry's Mod Wiki

Garry's Mod Wiki

  draw.DrawText( string text, string font = "DermaDefault", number x = 0, number y = 0, table color = Color( 255, 255, 255, 255 ), number xAlign = TEXT_ALIGN_LEFT )


Simple draw text at position, but this will expand newlines and tabs.

This is a rendering function that requires a 2d rendering context.

This means that it will only work in 2d Rendering Hooks.

See also MarkupObject for limited width and markup support.


1 string text
Text to be drawn.
2 string font = "DermaDefault"
Name of font to draw the text in. See surface.CreateFont to create your own, or Default Fonts for a list of default fonts.
3 number x = 0
The X Coordinate.
4 number y = 0
The Y Coordinate.
5 table color = Color( 255, 255, 255, 255 )
Color to draw the text in. Uses the Color.
6 number xAlign = TEXT_ALIGN_LEFT
Where to align the text horizontally. Uses the TEXT_ALIGN enum.


Makes a message saying Hello there! pop up in the center of your screen.

hook.Add( "HUDPaint", "HelloThere", function() draw.DrawText( "Hello there!", "TargetID", ScrW() * 0.5, ScrH() * 0.25, color_white, TEXT_ALIGN_CENTER ) end )
Hello there!

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...