2 CLASS(NexuizCheckBox) EXTENDS(CheckBox)
3 METHOD(NexuizCheckBox, configureNexuizCheckBox, void(entity, float, float, string, string))
4 METHOD(NexuizCheckBox, setChecked, void(entity, float))
5 ATTRIB(NexuizCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
6 ATTRIB(NexuizCheckBox, image, string, SKINGFX_CHECKBOX)
7 ATTRIB(NexuizCheckBox, yesValue, float, 1)
8 ATTRIB(NexuizCheckBox, noValue, float, 0)
10 ATTRIB(NexuizCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
11 ATTRIB(NexuizCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
12 ATTRIB(NexuizCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
13 ATTRIB(NexuizCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
15 ATTRIB(NexuizCheckBox, cvarName, string, string_null)
16 METHOD(NexuizCheckBox, loadCvars, void(entity))
17 METHOD(NexuizCheckBox, saveCvars, void(entity))
19 ATTRIB(NexuizCheckBox, alpha, float, SKINALPHA_TEXT)
20 ATTRIB(NexuizCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
21 ENDCLASS(NexuizCheckBox)
22 entity makeNexuizCheckBox(float, string, string);
23 entity makeNexuizCheckBoxEx(float, float, string, string);
27 entity makeNexuizCheckBox(float isInverted, string theCvar, string theText)
35 else if(isInverted < -1)
40 else if(isInverted == 1)
50 print("y = ", ftos(y), ", n = ", ftos(n), "\n");
51 return makeNexuizCheckBoxEx(y, n, theCvar, theText);
53 entity makeNexuizCheckBoxEx(float theYesValue, float theNoValue, string theCvar, string theText)
56 me = spawnNexuizCheckBox();
57 me.configureNexuizCheckBox(me, theYesValue, theNoValue, theCvar, theText);
60 void configureNexuizCheckBoxNexuizCheckBox(entity me, float theYesValue, float theNoValue, string theCvar, string theText)
62 me.yesValue = theYesValue;
63 me.noValue = theNoValue;
67 me.cvarName = theCvar;
70 me.configureCheckBox(me, theText, me.fontSize, me.image);
72 void setCheckedNexuizCheckBox(entity me, float val)
80 void loadCvarsNexuizCheckBox(entity me)
83 m = (me.yesValue + me.noValue) * 0.5;
84 d = (cvar(me.cvarName) - m) / (me.yesValue - m);
87 void saveCvarsNexuizCheckBox(entity me)
90 cvar_set(me.cvarName, ftos(me.yesValue));
92 cvar_set(me.cvarName, ftos(me.noValue));