2 CLASS(XonoticDecibelsSlider) EXTENDS(XonoticSlider)
3 METHOD(XonoticDecibelsSlider, loadCvars, void(entity))
4 METHOD(XonoticDecibelsSlider, saveCvars, void(entity))
5 METHOD(XonoticDecibelsSlider, valueToText, string(entity, float))
6 ENDCLASS(XonoticDecibelsSlider)
7 entity makeXonoticDecibelsSlider(float, float, float, string);
12 entity makeXonoticDecibelsSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
15 me = spawnXonoticDecibelsSlider();
16 me.configureXonoticSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
19 void XonoticDecibelsSlider_loadCvars(entity me)
26 v = cvar(me.cvarName);
28 Slider_setValue( me, 0 );
30 Slider_setValue( me, -1000000 );
32 Slider_setValue( me, 0.1 * floor(0.5 + 10.0 * log10(cvar(me.cvarName)) * 10) );
34 void XonoticDecibelsSlider_saveCvars(entity me)
40 cvar_set(me.cvarName, "1");
42 cvar_set(me.cvarName, "0");
44 cvar_set(me.cvarName, ftos(pow(10, me.value / 10)));
47 string XonoticDecibelsSlider_valueToText(entity me, float v)
50 return CTX(_("VOL^OFF"));
52 return CTX(_("VOL^MAX"));
53 return sprintf(_("%s dB"), SUPER(XonoticDecibelsSlider).valueToText(me, v));