Garry's Mod Wiki

Revision Difference

GM:HUDPaint#562039

<function name="HUDPaint" parent="GM" type="hook"> <description> Called whenever the HUD should be drawn. ⤶ Called right before <page>GM:HUDDrawScoreBoard</page> and after <page>GM:HUDPaintBackground</page>. Not called when the Camera SWEP is equipped, or when the main menu is visible. <page>GM:PostDrawHUD</page> does not have this behavior. ⤶ This is the ideal place to draw custom HUD elements. Not called when the Camera SWEP is equipped, or when the main menu is visible. To avoid this, use <page>GM:PostDrawHUD</page> instead. See also <page>GM:DrawOverlay</page>. <note>Gets called only when r_drawvgui and <page text="CHudGMod">GM:HUDShouldDraw</page> are enabled and the game is not paused</note> <rendercontext hook="true" type="2D"></rendercontext> </description> <realm>Client</realm> </function> <example> <description>Draws a transparent black box in the top left corner of the screen.</description> <code> hook.Add( "HUDPaint", "HUDPaint_DrawABox", function() surface.SetDrawColor( 0, 0, 0, 128 ) surface.DrawRect( 50, 50, 128, 128 ) end ) </code> </example>