Garry's Mod Wiki

Revision Difference

surface.DrawText#512030

<function name="DrawText" parent="surface" type="libraryfunc">⤶ <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>⤶ ⤶ <rendercontext hook="false" type="2D"/>⤶ </description>⤶ <realm>Client and Menu</realm>⤶ <args>⤶ <arg name="text" type="string">The text to be rendered.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Draws 'Hello World' on the screen. All functions in this example must be called for the draw to work flawlessly.</description>⤶ <code>⤶ hook.Add( "HUDPaint", "drawsometext", function()⤶ surface.SetFont( "Default" )⤶ surface.SetTextColor( 255, 255, 255 )⤶ surface.SetTextPos( 128, 128 ) ⤶ surface.DrawText( "Hello World" )⤶ end )⤶ </code>⤶ ⤶ </example>