From a8b4b3955be0547856d32be4a4ba44658bfcd561 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Mon, 9 Oct 2023 03:01:06 -0400 Subject: [PATCH] Attach a convar to the HUD scale --- gamemodes/benny/gamemode/modules/player/cl_hud.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 3d11656..665639d 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -17,8 +17,10 @@ hook.Add( "HUDShouldDraw", "HideHUD", function( name ) if ( hide[ name ] ) then return false end end ) +local HSCALE = CreateClientConVar( "benny_hud_scale", 1, true, false, "HUD scaling", 0, 4 ) + function ss( scale ) - return math.Round( scale * ( ScrH() / 480 ) ) + return math.Round( scale * ( ScrH() / 480 ) * HSCALE:GetFloat() ) end local function genfonts() @@ -63,6 +65,10 @@ local function genfonts() end genfonts() +cvars.AddChangeCallback("benny_hud_scale", function(convar_name, value_old, value_new) + genfonts() +end, "benny_hud_scale_callback") + schemes = { ["benny"] = { fg = Color( 255, 238, 169 ),