From 13a87c24b79ff4db6e1917409ce8a11b1d72b6e6 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 6 Sep 2017 23:40:09 -0400 Subject: Optomized health bar Changed health bar to use fade materials instead of manually drawing highlights/shadows. --- gamemode/client/hud/cl_healthbar.lua | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'gamemode/client') diff --git a/gamemode/client/hud/cl_healthbar.lua b/gamemode/client/hud/cl_healthbar.lua index 5655b1c..2705a42 100644 --- a/gamemode/client/hud/cl_healthbar.lua +++ b/gamemode/client/hud/cl_healthbar.lua @@ -138,19 +138,11 @@ hook.Add("HUDPaint", "HUD_DrawHealth", function() surface.SetDrawColor(150, 0, 0, 255) surface.DrawRect(xs, ys, barlength, barheight) --Heighlighting/shadows - local heighlightheight = barheight / 3 - - for k = 1, heighlightheight do - local perc = Lerp(k / heighlightheight, 100, 0) - surface.SetDrawColor(150 + perc, perc, perc, 255) - surface.DrawRect(xs, ys + k, barlength, 1) - end - - for k = 1, heighlightheight do - local perc = Lerp(k / heighlightheight, 0, 100) - surface.SetDrawColor(150 - perc, 0, 0, 255) - surface.DrawRect(xs, ys + k + (2 * heighlightheight), barlength, 1) - end + surface.SetTexture( surface.GetTextureID("gui/gradient.vtf") ) + surface.SetDrawColor( 0, 0, 0, 255 ) + surface.DrawTexturedRectRotated( xs + (barlength/2), ys + (barheight/4) * 3, barheight/2, barlength,90) + surface.SetDrawColor( 255, 255, 255, 50 ) + surface.DrawTexturedRectRotated( xs + (barlength/2), ys + (barheight/8), barheight/4, barlength,270) --Draw bubbles render.SetScissorRect(xs, ys, xs + barlength, ys + barheight, true) -- Enable the rect -- cgit v1.2.3-70-g09d2