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))
19 ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
20 ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
21 ENDCLASS(XonoticCheckBox)
22 entity makeXonoticCheckBox(float, string, string);
23 entity makeXonoticCheckBoxEx(float, float, string, string);
27 entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
35 else if(isInverted < -1)
40 else if(isInverted == 1)
50 return makeXonoticCheckBoxEx(y, n, theCvar, theText);
52 entity makeXonoticCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
55 me = spawnXonoticCheckBox();
56 me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText);
59 void XonoticCheckBox_configureXonoticCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
61 me.yesValue = theYesValue;
62 me.noValue = theNoValue;
66 me.cvarName = theCvar;
67 me.tooltip = getZonedTooltipForIdentifier(theCvar);
70 me.configureCheckBox(me, theText, me.fontSize, me.image);
72 void XonoticCheckBox_setChecked(entity me, float val)
80 void XonoticCheckBox_loadCvars(entity me)
87 m = (me.yesValue + me.noValue) * 0.5;
88 d = (cvar(me.cvarName) - m) / (me.yesValue - m);
91 void XonoticCheckBox_saveCvars(entity me)
97 cvar_set(me.cvarName, ftos(me.yesValue));
99 cvar_set(me.cvarName, ftos(me.noValue));