From: terencehill Date: Thu, 25 Aug 2016 12:59:46 +0000 (+0200) Subject: Reload hud_fontsize and fix scoreboard layout as soon as user changes hud_fontsize... X-Git-Tag: xonotic-v0.8.2~670 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aa4ae235fdf5c617847714a152012b65bae547d9;p=xonotic%2Fxonotic-data.pk3dir.git Reload hud_fontsize and fix scoreboard layout as soon as user changes hud_fontsize and displays the scoreboard --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index c283be1c4..541e34eb3 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -10,6 +10,9 @@ // Scoreboard (#24) +string autocvar_hud_fontsize; +string hud_fontsize_str; + float sbt_bg_alpha; float sbt_fg_alpha; float sbt_fg_alpha_self; @@ -754,6 +757,12 @@ string Scoreboard_FixColumnWidth(int i, string str) return str; } +void Scoreboard_initFieldSizes() +{ + for(int i = 0; i < sbt_num_fields; ++i) + sbt_field_size[i] = stringwidth(sbt_field_title[i], false, hud_fontsize); +} + vector Scoreboard_DrawHeader(vector pos, vector rgb) { int i; @@ -1290,6 +1299,14 @@ void Scoreboard_Draw() scoreboard_fade_alpha = min(1, scoreboard_fade_alpha + frametime * scoreboard_fadeinspeed); else scoreboard_fade_alpha = 1; + if(hud_fontsize_str != autocvar_hud_fontsize) + { + hud_fontsize = HUD_GetFontsize("hud_fontsize"); + Scoreboard_initFieldSizes(); + if(hud_fontsize_str) + strunzone(hud_fontsize_str); + hud_fontsize_str = strzone(autocvar_hud_fontsize); + } } else { float scoreboard_fadeoutspeed = autocvar_hud_panel_scoreboard_fadeoutspeed;