• HUD Resolution Optimization
    2 replies, posted
Hi all, basically I've made a HUD: [url]http://prntscr.com/9zfqeg[/url] I made it when my resolution was 1280 x 720, I then changed my resolution and its all over the place. Here is the code for the HUD: [code] hook.Add( "HUDPaint", "right_hud", function() surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( rightMat ) -- If you use Material, cache it! surface.DrawTexturedRect( 880, 640, 400, 80 ) end ) local leftMat = Material( "hud/hudtest2.png" ) -- Calling Material() every frame is quite expensive hook.Add( "HUDPaint", "left_hud", function() surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( leftMat ) -- If you use Material, cache it! surface.DrawTexturedRect( 0, 640, 400, 80 ) end ) [/code] Any help is appreciated, my LUA is limited as I've recently been learning. If need be I will pay a small sum for someone to fix it. Thanks for your time.
[CODE]hook.Add( "HUDPaint", "new_hud", function() surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( rightMat) -- If you use Material, cache it! surface.DrawTexturedRect( ScrW() - 400, ScrH() - 80, 400, 80 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( leftMat) -- If you use Material, cache it! surface.DrawTexturedRect( 0, ScrH() - 80, 400, 80 ) end )[/CODE] All good dude! Just helped you on Steam, but yeah, thought I'd put it on here!
Thanks man, my material HUD is now fixed permanently. Does anyone know how I can fix the HP bar? [code]draw.RoundedBox( 8, 935, ScrH() -48, 310, 17, Color( 215, 215, 215 ) )[/code] is what I'm using at the moment but similar to the fix issue it moves when you change resolution
Sorry, you need to Log In to post a reply to this thread.