1 #include "gametypebutton.qh"
2 #ifndef GAMETYPEBUTTON_H
3 #define GAMETYPEBUTTON_H
4 #include "../item/radiobutton.qc"
5 CLASS(XonoticGametypeButton, RadioButton)
6 METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string));
7 METHOD(XonoticGametypeButton, setChecked, void(entity, float));
8 ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
9 ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
10 ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
11 ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
12 ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
13 ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
14 ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
15 ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
17 ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
18 METHOD(XonoticGametypeButton, loadCvars, void(entity));
19 METHOD(XonoticGametypeButton, saveCvars, void(entity));
21 ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
22 ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
23 ENDCLASS(XonoticGametypeButton)
24 entity makeXonoticGametypeButton(float, string, string);
28 void GameTypeButton_Click(entity me, entity other);
29 entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
32 me = NEW(XonoticGametypeButton);
33 me.configureXonoticGametypeButton(me, theGroup, theCvar, theText, theTooltip);
36 void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText, string theTooltip)
38 me.cvarName = (theCvar) ? theCvar : string_null;
40 setZonedTooltip(me, theTooltip, theCvar);
41 me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
43 me.onClick = GameTypeButton_Click;
44 me.onClickEntity = NULL;
46 void XonoticGametypeButton_setChecked(entity me, float val)
54 void XonoticGametypeButton_loadCvars(entity me)
59 me.checked = cvar(me.cvarName);
61 void XonoticGametypeButton_saveCvars(entity me)
66 cvar_set(me.cvarName, ftos(me.checked));
68 void GameTypeButton_Click(entity me, entity other)
70 RadioButton_Click(me, other);
71 me.parent.gameTypeChangeNotify(me.parent);