1 #ifndef GAMETYPEBUTTON_H
2 #define GAMETYPEBUTTON_H
3 #include "../item/radiobutton.qc"
4 CLASS(XonoticGametypeButton, RadioButton)
5 METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string));
6 METHOD(XonoticGametypeButton, setChecked, void(entity, float));
7 ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
8 ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
9 ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
10 ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
11 ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
12 ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
13 ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
14 ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
16 ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
17 METHOD(XonoticGametypeButton, loadCvars, void(entity));
18 METHOD(XonoticGametypeButton, saveCvars, void(entity));
20 ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
21 ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
22 ENDCLASS(XonoticGametypeButton)
23 entity makeXonoticGametypeButton(float, string, string);
27 void GameTypeButton_Click(entity me, entity other);
28 entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
31 me = NEW(XonoticGametypeButton);
32 me.configureXonoticGametypeButton(me, theGroup, theCvar, theText, theTooltip);
35 void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText, string theTooltip)
39 me.cvarName = theCvar;
40 me.tooltip = getZonedTooltip(theTooltip, theCvar);
43 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
45 me.onClick = GameTypeButton_Click;
46 me.onClickEntity = NULL;
48 void XonoticGametypeButton_setChecked(entity me, float val)
56 void XonoticGametypeButton_loadCvars(entity me)
61 me.checked = cvar(me.cvarName);
63 void XonoticGametypeButton_saveCvars(entity me)
68 cvar_set(me.cvarName, ftos(me.checked));
70 void GameTypeButton_Click(entity me, entity other)
72 RadioButton_Click(me, other);
73 me.parent.gameTypeChangeNotify(me.parent);