diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 77a7ff7..d194772 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -8,6 +8,7 @@ if CLIENT then include( "shared.lua" ) Quantum.Client = {} + Quantum.Client.ResolutionScale = ScrW() / 1080 -- Add all core files @@ -18,7 +19,7 @@ if CLIENT then -- Shared files local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) for _, file in pairs( shFiles ) do - include( fol .. file ) + include( fol .. file ) end -- CLient files diff --git a/gamemode/core/client/cl_fonts.lua b/gamemode/core/client/cl_fonts.lua new file mode 100644 index 0000000..77fd27b --- /dev/null +++ b/gamemode/core/client/cl_fonts.lua @@ -0,0 +1,6 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ \ No newline at end of file diff --git a/gamemode/core/client/cl_hud.lua b/gamemode/core/client/cl_hud.lua index 6e26e61..9a9b816 100644 --- a/gamemode/core/client/cl_hud.lua +++ b/gamemode/core/client/cl_hud.lua @@ -5,4 +5,40 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -hook.Add( "HUDShouldDraw", "Quantum_RemoveDefualtHUD", function() return false end) \ No newline at end of file +local enabledHUDs = { + ["CHudChat"] = true, + ["CHudGMod"] = true +} + +hook.Add( "HUDShouldDraw", "Quantum_RemoveDefualtHUD", function( hudid ) + return enabledHUDs[hudid] ~= nil +end) + + +local scale = Quantum.Client.ResolutionScale +local barW, barH = 250 * scale, 10 * scale +local padding = 2 * scale +local sw, sh = ScrW(), ScrH() + +function GM:HUDPaint() + local hp = LocalPlayer():Health() + local lasthp = hp + local maxhp = LocalPlayer():GetMaxHealth() + + if( Quantum.Client.Config.EnableHUD ) then + if !LocalPlayer():Alive() then return end + print( lasthp, LocalPlayer():Health() ) + if( LocalPlayer():Health() ~= lasthp ) then + lasthp = Lerp( 0.5, lasthp, hp ) + end + + -- Health border + surface.SetDrawColor( 0, 0, 0, 200 ) + surface.DrawRect( sw/2 - barW/2, sh*0.9, barW, barH ) + + -- Health + surface.SetDrawColor( 168, 62, 50, 255 ) + surface.DrawRect( (sw/2 - barW/2) + padding/2, (sh*0.9) + padding/2, barW - padding, barH - padding ) + end + +end \ No newline at end of file