3 CLASS(XonoticCheckBox, CheckBox)
4 METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string))
5 METHOD(XonoticCheckBox, setChecked, void(entity, float))
6 ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
7 ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
8 ATTRIB(XonoticCheckBox, yesValue, float, 1)
9 ATTRIB(XonoticCheckBox, noValue, float, 0)
11 ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
12 ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
13 ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
14 ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
16 ATTRIB(XonoticCheckBox, cvarName, string, string_null)
17 METHOD(XonoticCheckBox, loadCvars, void(entity))
18 METHOD(XonoticCheckBox, saveCvars, void(entity))
19 ATTRIB(XonoticCheckBox, sendCvars, float, 0)
21 ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
22 ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
23 ENDCLASS(XonoticCheckBox)
24 entity makeXonoticCheckBox(float, string, string);
25 entity makeXonoticCheckBoxEx(float, float, string, string);
29 entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
37 else if(isInverted < -1)
42 else if(isInverted == 1)
52 return makeXonoticCheckBoxEx(y, n, theCvar, theText);
54 entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
57 me = NEW(XonoticCheckBox);
58 me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
61 void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
63 me.yesValue = theYesValue;
64 me.noValue = theNoValue;
68 me.cvarName = theCvar;
69 me.tooltip = getZonedTooltipForIdentifier(theCvar);
72 me.configureCheckBox(me, theText, me.fontSize, me.image);
74 void XonoticCheckBox_setChecked(entity me, float val)
82 void XonoticCheckBox_loadCvars(entity me)
89 m = (me.yesValue + me.noValue) * 0.5;
90 d = (cvar(me.cvarName) - m) / (me.yesValue - m);
93 void XonoticCheckBox_saveCvars(entity me)
99 cvar_set(me.cvarName, ftos(me.yesValue));
101 cvar_set(me.cvarName, ftos(me.noValue));
103 CheckSendCvars(me, me.cvarName);