From: Rudolf Polzer Date: Wed, 18 Sep 2013 08:30:02 +0000 (+0200) Subject: Inform the slider properly. X-Git-Tag: xonotic-v0.8.0~315^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c176a3b5208371a6f28fcaa87d072c889b4274fa;p=xonotic%2Fxonotic-data.pk3dir.git Inform the slider properly. --- diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 312a2dc2c..eb68729ba 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -22,7 +22,7 @@ float conwidth_s, conheight_s, vidwidth_s, vidheight_s, vidpixelheight_s, void m_sync() { updateCompression(); - vidwidth_s = vidheight_s = vidpixelheight_s = 0; + vidwidth_s = vidheight_s = vidpixelheight_s = 0; // Force updateConwidths on next draw. loadAllCvars(main); } diff --git a/qcsrc/menu/xonotic/slider_resolution.c b/qcsrc/menu/xonotic/slider_resolution.c index d404e8099..24e9cb9b8 100644 --- a/qcsrc/menu/xonotic/slider_resolution.c +++ b/qcsrc/menu/xonotic/slider_resolution.c @@ -4,12 +4,16 @@ CLASS(XonoticResolutionSlider) EXTENDS(XonoticTextSlider) METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float)) METHOD(XonoticResolutionSlider, loadCvars, void(entity)) METHOD(XonoticResolutionSlider, saveCvars, void(entity)) + METHOD(XonoticResolutionSlider, draw, void(entity)) ENDCLASS(XonoticResolutionSlider) entity makeXonoticResolutionSlider(); void updateConwidths(float width, float height, float pixelheight); #endif #ifdef IMPLEMENTATION + +/* private static */ float XonoticResolutionSlider_DataHasChanged; + // Updates cvars (to be called by menu.qc at startup or on detected res change) void updateConwidths(float width, float height, float pixelheight) { @@ -56,6 +60,7 @@ void updateConwidths(float width, float height, float pixelheight) cvar_set("vid_conwidth", ftos(rint(c_x))); cvar_set("vid_conheight", ftos(rint(c_y))); + XonoticResolutionSlider_DataHasChanged = TRUE; } entity makeXonoticResolutionSlider() { @@ -124,4 +129,13 @@ void XonoticResolutionSlider_saveCvars(entity me) cvar_set("_menu_vid_pixelheight", argv(2)); } } +void XonoticResolutionSlider_draw(entity me) +{ + if (XonoticResolutionSlider_DataHasChanged) + { + XonoticResolutionSlider_DataHasChanged = FALSE; + me.loadCvars(me); + } + SUPER(XonoticResolutionSlider).draw(me); +} #endif