Garry's Mod Wiki

GM:PostDrawHUD

  GM:PostDrawHUD()

Description

Called after GM:PreDrawHUD, GM:HUDPaintBackground and GM:HUDPaint but before GM:DrawOverlay.

Unlike GM:HUDPaint(Background) hooks, this will still be called when the main menu is visible. And so will be GM:PreDrawHUD

This is a rendering hook which provides a 2d rendering context.

Example

Draws a transparent black box in the top left corner of the screen.

hook.Add( "PostDrawHUD", "DrawHelloWorldBox", function() local w = 256 local h = 64 cam.Start2D() -- If you don't call this the text inside the hook will render odd. surface.SetDrawColor( 20, 20, 20, 200 ) surface.DrawRect( 0, 0, w, h ) draw.SimpleText( "Hello World", "Trebuchet24", w / 2, h / 2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) cam.End2D() end )