2 CLASS(XonoticCheckBox) EXTENDS(CheckBox)
3 METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string))
4 METHOD(XonoticCheckBox, setChecked, void(entity, float))
5 ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
6 ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
7 ATTRIB(XonoticCheckBox, yesValue, float, 1)
8 ATTRIB(XonoticCheckBox, noValue, float, 0)
10 ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
11 ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
12 ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
13 ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
15 ATTRIB(XonoticCheckBox, cvarName, string, string_null)
16 METHOD(XonoticCheckBox, loadCvars, void(entity))
17 METHOD(XonoticCheckBox, saveCvars, void(entity))
18 ATTRIB(XonoticCheckBox, sendCvars, float, 0)
20 ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
21 ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
22 ENDCLASS(XonoticCheckBox)
23 entity makeXonoticCheckBox(float, string, string);
24 entity makeXonoticCheckBoxEx(float, float, string, string);
28 entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
36 else if(isInverted < -1)
41 else if(isInverted == 1)
51 return makeXonoticCheckBoxEx(y, n, theCvar, theText);
53 entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
56 me = spawnXonoticCheckBox();
57 me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
60 void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
62 me.yesValue = theYesValue;
63 me.noValue = theNoValue;
67 me.cvarName = theCvar;
68 me.tooltip = getZonedTooltipForIdentifier(theCvar);
71 me.configureCheckBox(me, theText, me.fontSize, me.image);
73 void XonoticCheckBox_setChecked(entity me, float val)
81 void XonoticCheckBox_loadCvars(entity me)
88 m = (me.yesValue + me.noValue) * 0.5;
89 d = (cvar(me.cvarName) - m) / (me.yesValue - m);
92 void XonoticCheckBox_saveCvars(entity me)
98 cvar_set(me.cvarName, ftos(me.yesValue));
100 cvar_set(me.cvarName, ftos(me.noValue));
102 CheckSendCvars(me, me.cvarName);