Garry's Mod Wiki

draw.SimpleText

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

Description

Draws text on the screen.

This function does not handle newlines properly. See draw.DrawText for a function that does.
This is a rendering function that requires a 2d rendering context.

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

Arguments

1 string text
The text to be drawn.
2 string font = "DermaDefault"
The font. See surface.CreateFont to create your own, or see 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 )
The color of the text. Uses the Color.
6 number xAlign = TEXT_ALIGN_LEFT
The alignment of the X coordinate using TEXT_ALIGN enum.
7 number yAlign = TEXT_ALIGN_TOP
The alignment of the Y coordinate using TEXT_ALIGN enum.

Returns

1 number
The width of the text. Same value as if you were calling surface.GetTextSize.
2 number
The height of the text. Same value as if you were calling surface.GetTextSize.

Example

Example usage

hook.Add( "HUDPaint", "HelloThere", function() draw.SimpleText( "Hello there!", "DermaDefault", 50, 50, color_white ) end )