]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow to change text alignment in the quick menu
authorterencehill <piuntn@gmail.com>
Fri, 2 Dec 2011 23:06:26 +0000 (00:06 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 3 Dec 2011 18:22:21 +0000 (19:22 +0100)
_hud_descriptions.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc
qcsrc/menu/xonotic/dialog_hudpanel_quickmenu.c

index c9ed70c5115665147c3166e4e475f2bae818caf9..08ecb6f6528d991821638ff5392dca1a4b1b133c 100644 (file)
@@ -297,3 +297,4 @@ seta hud_panel_quickmenu_bg_color_team "" "override panel color with team color
 seta hud_panel_quickmenu_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
 seta hud_panel_quickmenu_bg_border "" "if set to something else than \"\" = override default size of border around the background"
 seta hud_panel_quickmenu_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_quickmenu_align "text alignment: 0 left, 0.5 center, 1 right"
index fc7edc5d6429c57d2cb5b2a6b76a79a1abacd4eb..a05b3bf03b1f42ef8c1cd4085237f19e88c8afbf 100644 (file)
@@ -291,5 +291,6 @@ seta hud_panel_quickmenu_bg_color_team ""
 seta hud_panel_quickmenu_bg_alpha ""
 seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
 
 menu_sync
index cf1d8fc33ff76290e32e4b59935ea62ebad308b0..5900fdf87cc85e9dbc8b89f9c0f21c51e0f70d3f 100644 (file)
@@ -291,5 +291,6 @@ seta hud_panel_quickmenu_bg_color_team ""
 seta hud_panel_quickmenu_bg_alpha ""
 seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
 
 menu_sync
index 1e43ab80c4970db1844a01a5c52497e7b43b83db..11ba6e4eb4a8567cf9729d842b85f9233e3140de 100644 (file)
@@ -291,5 +291,6 @@ seta hud_panel_quickmenu_bg_color_team ""
 seta hud_panel_quickmenu_bg_alpha ""
 seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
 
 menu_sync
index de67dbb2440d9391845a42cd1f71b1995277cd61..df9b804fdad459e9abf81e886655087de92c3548 100644 (file)
@@ -291,5 +291,6 @@ seta hud_panel_quickmenu_bg_color_team ""
 seta hud_panel_quickmenu_bg_alpha ""
 seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "1"
 
 menu_sync
index 9652d43a00c3dedb8b174349651981d23b12dfe8..88d380c87125e45db9052498b1ae74d04a58cb3a 100644 (file)
@@ -291,5 +291,6 @@ seta hud_panel_quickmenu_bg_color_team ""
 seta hud_panel_quickmenu_bg_alpha ""
 seta hud_panel_quickmenu_bg_border ""
 seta hud_panel_quickmenu_bg_padding ""
+seta hud_panel_quickmenu_align "0"
 
 menu_sync
index 1325c6324b1e1b88b92d4dffff922ee1f0d18fef..b7f96375cbfcdeab03870e69f93b588753499520 100644 (file)
@@ -320,6 +320,7 @@ float autocvar_hud_panel_weapons_onlyowned;
 float autocvar_hud_panel_weapons_timeout;
 float autocvar_hud_panel_weapons_timeout_effect;
 float autocvar_hud_panel_quickmenu;
+float autocvar_hud_panel_quickmenu_align;
 float autocvar_hud_progressbar_alpha;
 float autocvar_hud_showbinds;
 float autocvar_hud_showbinds_limit;
index ec2bb8257f893a5efa3c136bcde0797bb71e9698..a665ca55327a31f15f4525b598f941093c4aa681 100644 (file)
@@ -5112,6 +5112,19 @@ void HUD_Panel_QuickMenu_Mouse()
        const vector cursorsize = '32 32 0';
        drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', 0.8, DRAWFLAG_NORMAL);
 }
+void HUD_QuickMenu_DrawEntry(vector pos, string s, vector fontsize)
+{
+       string entry;
+       float offset;
+       entry = textShortenToWidth(s, panel_size_x, fontsize, stringwidth_colors);
+       if (autocvar_hud_panel_quickmenu_align > 0)
+       {
+               offset = (panel_size_x - stringwidth_colors(entry, fontsize)) * min(autocvar_hud_panel_quickmenu_align, 1);
+               drawcolorcodedstring(pos + eX * offset, entry, fontsize, 1, DRAWFLAG_ADDITIVE);
+       }
+       else
+               drawcolorcodedstring(pos + eY * (panel_size_y - fontsize_y), entry, fontsize, 1, DRAWFLAG_ADDITIVE);
+}
 void HUD_QuickMenu(void)
 {
        if(!autocvar__hud_configure)
@@ -5150,14 +5163,13 @@ void HUD_QuickMenu(void)
 
        float i;
        vector fontsize;
-       string entry, color;
+       string color;
        fontsize = '1 1 0' * (panel_size_y / QUICKMENU_MAXLINES);
 
        if (!QuickMenu_IsLastPage)
        {
                color = "^5";
-               entry = textShortenToWidth(sprintf("%d: %s%s", 0, color, _("Continue...")), panel_size_x, fontsize, stringwidth_colors);
-               drawcolorcodedstring(panel_pos + eY * (panel_size_y - fontsize_y), entry, fontsize, 1, DRAWFLAG_ADDITIVE);
+               HUD_QuickMenu_DrawEntry(panel_pos + eY * (panel_size_y - fontsize_y), sprintf("%d: %s%s", 0, color, _("Continue...")), fontsize);
        }
        else
                panel_pos_y += ((QUICKMENU_MAXLINES - QuickMenu_Entries) * fontsize_y) / 2;
@@ -5169,8 +5181,7 @@ void HUD_QuickMenu(void)
                        color = "^4";
                else
                        color = "^3";
-               entry = textShortenToWidth(sprintf("%d: %s%s", i, color, QuickMenu_Description[i]), panel_size_x, fontsize, stringwidth_colors);
-               drawcolorcodedstring(panel_pos, entry, fontsize, 1, DRAWFLAG_ADDITIVE);
+               HUD_QuickMenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Description[i]), fontsize);
                panel_pos_y += fontsize_y;
        }
 }
index 18ff119a79ef636abbf231f6a7cb92ae0ea5e49b..6399dde2e8333990ddd223c46b82093ff1f88ba3 100644 (file)
@@ -177,6 +177,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
                                        HUD_Write_PanelCvar_q("_fade_minfontsize");
                                        break;
+                               case HUD_PANEL_QUICKMENU:
+                                       HUD_Write_PanelCvar_q("_align");
+                                       break;
                        }
                        HUD_Write("\n");
                }
index f9527d42351de5fb3dc2d7563a5745f83905de0d..4aed758a56e2bdca248185c3b220b3ade0069624 100644 (file)
@@ -17,5 +17,13 @@ void XonoticHUDQuickMenuDialog_fill(entity me)
        string panelname = "quickmenu";
 
        DIALOG_HUDPANEL_COMMON();
+
+       me.TR(me);
+               me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Text alignment:")));
+       me.TR(me);
+               me.TDempty(me, 0.2);
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0", _("Left")));
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0.5", _("Center")));
+                       me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "1", _("Right")));
 }
 #endif