]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add underline to centerprint title
authorz411 <z411@omaera.org>
Fri, 11 Mar 2022 03:35:04 +0000 (00:35 -0300)
committerz411 <z411@omaera.org>
Fri, 11 Mar 2022 03:35:04 +0000 (00:35 -0300)
qcsrc/client/hud/panel/centerprint.qc

index 22824a1719cf774bb6aec06f20f48fb00631b994..f37d0c24a04bec2bb006ec075b5a00abf0275a69 100644 (file)
@@ -34,7 +34,7 @@ void HUD_CenterPrint_Export(int fh)
 const int CENTERPRINT_MAX_MSGS = 10;
 const int CENTERPRINT_MAX_ENTRIES = 50;
 const float CENTERPRINT_SPACING = 0.5;
-const float CENTERPRINT_TITLE_SPACING = 1;
+const float CENTERPRINT_TITLE_SPACING = 0.8;
 int cpm_index;
 string centerprint_messages[CENTERPRINT_MAX_MSGS];
 int centerprint_msgID[CENTERPRINT_MAX_MSGS];
@@ -260,14 +260,22 @@ void HUD_CenterPrint()
        // Show title if available
        if(centerprint_title_show) {
                vector fontsize = hud_fontsize * autocvar_hud_panel_centerprint_fontscale_title;
+               float width = stringwidth(centerprint_title, true, fontsize);
 
-               pos.x = panel_pos.x + (panel_size.x - stringwidth(centerprint_title, true, fontsize)) * align;
+               pos.x = panel_pos.x + (panel_size.x - width) * align;
                drawcolorcodedstring(pos, centerprint_title, fontsize, 1, DRAWFLAG_NORMAL);
 
                if (autocvar_hud_panel_centerprint_flip)
-                       pos.y -= fontsize.y + CENTERPRINT_TITLE_SPACING;
+                       pos.y -= fontsize.y + (hud_fontsize.y * CENTERPRINT_TITLE_SPACING / 2);
                else
-                       pos.y += fontsize.y + CENTERPRINT_TITLE_SPACING;
+                       pos.y += fontsize.y + (hud_fontsize.y * CENTERPRINT_TITLE_SPACING / 2);
+
+               drawfill(pos, vec2(width, 1), '1 1 1', 1, DRAWFLAG_NORMAL);
+
+               if (autocvar_hud_panel_centerprint_flip)
+                       pos.y -= hud_fontsize.y * CENTERPRINT_TITLE_SPACING / 2;
+               else
+                       pos.y += hud_fontsize.y * CENTERPRINT_TITLE_SPACING / 2;
 
                all_messages_expired = false;
        }