• Simple DPanel and HudPaint Question
    3 replies, posted
Hello, How would it be possible to bring the text in-front of the panel? [CODE]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 )[/CODE] This is what I am currently getting: [IMG]https://i.gyazo.com/2494952d2acdb38a591f43baca1f4fdc.png[/IMG]
I don't think you can do that unless you do one of the following: [B]Use a DLabel instead of the HUDPaint-hook-text you're drawing[/B] OR [B]Draw the box in the HUDPaint hook instead[/B] [editline]20th February 2016[/editline] E.g. [CODE] 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 ) [/CODE]
[QUOTE=MPan1;49777834]I don't think you can do that unless you do one of the following: [B]Use a DLabel instead of the HUDPaint-hook-text you're drawing[/B] OR [B]Draw the box in the HUDPaint hook instead[/B] [editline]20th February 2016[/editline] E.g. [CODE] 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 ) [/CODE][/QUOTE] 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
Sorry, you need to Log In to post a reply to this thread.