From: terencehill Date: Wed, 3 Jun 2015 17:59:29 +0000 (+0200) Subject: Use images for quickmenu option checkboxes X-Git-Tag: xonotic-v0.8.2~1987^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f9cca54a45bb9a04d0e1f024794ba1a942e716ce;p=xonotic%2Fxonotic-data.pk3dir.git Use images for quickmenu option checkboxes --- diff --git a/gfx/hud/default/checkbox_checked.tga b/gfx/hud/default/checkbox_checked.tga new file mode 100644 index 000000000..ff8941d9e Binary files /dev/null and b/gfx/hud/default/checkbox_checked.tga differ diff --git a/gfx/hud/default/checkbox_empty.tga b/gfx/hud/default/checkbox_empty.tga new file mode 100644 index 000000000..e7d644e9a Binary files /dev/null and b/gfx/hud/default/checkbox_empty.tga differ diff --git a/gfx/hud/default/checkbox_undefined.tga b/gfx/hud/default/checkbox_undefined.tga new file mode 100644 index 000000000..1b80a3744 Binary files /dev/null and b/gfx/hud/default/checkbox_undefined.tga differ diff --git a/qcsrc/client/quickmenu.qc b/qcsrc/client/quickmenu.qc index 5dd2790b9..780778ec9 100644 --- a/qcsrc/client/quickmenu.qc +++ b/qcsrc/client/quickmenu.qc @@ -527,17 +527,21 @@ void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector font { string entry; float offset; - float desc_size = panel_size_x; + float desc_width = panel_size_x; if(option) { - float option_size = stringwidth_nocolors(option, fontsize); - desc_size -= option_size; - drawstring(pos + eX * desc_size, option, fontsize, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE); + string pic = strcat(hud_skin_path, "/", option); + if(precache_pic(pic) == "") + pic = strcat("gfx/hud/default/", option); + vector option_size = '1 1 0' * fontsize.y * 0.8; + desc_width -= option_size.x; + drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE); + desc_width -= fontsize_x / 4; } - entry = textShortenToWidth(desc, desc_size, fontsize, stringwidth_colors); + entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors); if (autocvar_hud_panel_quickmenu_align > 0) { - offset = (desc_size - stringwidth_colors(entry, fontsize)) * min(autocvar_hud_panel_quickmenu_align, 1); + offset = (desc_width - stringwidth_colors(entry, fontsize)) * min(autocvar_hud_panel_quickmenu_align, 1); drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE); } else @@ -636,11 +640,11 @@ void HUD_QuickMenu(void) float value = cvar(argv(1)); if(value == ON_value) - option = "[X]"; + option = "checkbox_checked"; else if(value == OFF_value) - option = "[_]"; + option = "checkbox_empty"; else - option = "[?]"; + option = "checkbox_undefined"; } } }