Garry's Mod Wiki

Revision Difference

GM:PreDrawHUD#511244

<function name="PreDrawHUD" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called before any of 2D drawing functions. Drawing anything in it seems to work incorrectly.&amp;lt;!--⤶ ⤶ <rendercontext hook="true" type="2D"/>--&amp;gt;⤶ </description>⤶ <realm>Client</realm>⤶ <predicted>No</predicted>⤶ </function>⤶ ⤶ <example>⤶ <description>Allows you to draw something before any other HUD elements.</description>⤶ <code>⤶ local clr = Color(20, 20, 20, 200)⤶ hook.Add("PreDrawHUD", "PreDrawExample", function()⤶ cam.Start2D() -- If you don't call this the drawing will not work properly.⤶ ⤶ surface.SetDrawColor(clr)⤶ surface.DrawRect(0, 0, ScrW(), ScrH())⤶ ⤶ cam.End2D()⤶ end)⤶ </code>⤶ ⤶ </example>