Ok so im making a hud in gmod and i have this proble that whenever i look at a rpop, entity, winder, door player ect it disapears until i look aways, any ideas why, heres my code :
[CODE]
local SC=ScrW()/2
function ScrS(number)
return ScreenScale(number)
end
local HUDOutline = {
{x=SC-ScrS(200),y=0},
{x=SC+ScrS(200),y=0},
{x=SC+ScrS(180),y=ScrS(20)},
{x=SC-ScrS(180),y=ScrS(20)}
}
function testHUD()
surface.SetDrawColor(100,100,100,255)
surface.DrawPoly(HUDOutline)
end
hook.Add("HUDPaint","testHUD",testHUD)
[/CODE]
Typically the hud disappears if there is an error in the hud, or you set HUDShouldDraw to false in certain cases...
There's also:
[code]//
// Desc: Draw the target id ( the name of the player you're currently looking at )
//
function GM:HUDDrawTargetID( )
return true;
end[/code]
Take a look at this for hud creation ( and how to use HUDShouldDraw in an optimized way ):
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/proper_hud_creation.lua.html[/url]
This for creating shapes using poly ( it also briefly covers recreating the poly if the screensize changes ):
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/poly/creating_shapes_using_poly.lua.html[/url]
Understanding screensizes / how to hard-code a screensize and have the object show up the same on all resolutions: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/understanding_hardcoding_of_screensizes.lua.html[/url]
Without knowing if there's an error being output, the game-mode you're using, etc, there isn't much we can do aside from speculate... But, my guess is there is an error somewhere which is causing the issue.
Sorry, you need to Log In to post a reply to this thread.