Simple DPanel and HudPaint Question

Hello,

How would it be possible to bring the text in-front of the panel?


local panel = vgui.Create( "DPanel" )
panel:SetSize( 300, 65 )
panel:SetPos( 5, 5 )

function panel:Paint( w, h )
	draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0 ) )
end

hook.Add( "HUDPaint", "Test", function()
	
	surface.SetFont( "dgfontnormal" )
	surface.SetTextColor( 255, 255, 255, 255 )
	surface.SetTextPos( 5, 5 )
	surface.DrawText( "Test111" )
end )

hook.Add( "HUDPaint", "Test54", function()
	surface.SetFont( "dgfontmed" )
	surface.SetTextColor( 255, 255, 255, 255 )
	surface.SetTextPos( 15, 25 )
	surface.DrawText( "Test222" )
end )

This is what I am currently getting:

I don’t think you can do that unless you do one of the following:

Use a DLabel instead of the HUDPaint-hook-text you’re drawing

OR

Draw the box in the HUDPaint hook instead

[editline]20th February 2016[/editline]

E.g.



hook.Add( "HUDPaint", "Test", function()

	draw.RoundedBox( 0, 5, 5, 300, 65, Color( 0, 0, 0 ) )

	surface.SetFont( "dgfontnormal" )
	surface.SetTextColor( 255, 255, 255, 255 )
	surface.SetTextPos( 5, 5 )
	surface.DrawText( "Test111" )

	surface.SetFont( "dgfontmed" )
	surface.SetTextColor( 255, 255, 255, 255 )
	surface.SetTextPos( 15, 25 )
	surface.DrawText( "Test222" )
end )


Thank you!

I think all the vgui stuff must get internally drawn on top of any HUDPaint stuff you have, so that’s probably why it doesn’t work