]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/button.qc
Unify boolean constants
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / button.qc
1 #ifdef INTERFACE
2 CLASS(XonoticButton) EXTENDS(Button)
3         METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector))
4         ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
5         ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
6         ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
7         ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
8         ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
9         ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
10         ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
11         ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
12         ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
13         ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
14         ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
15 ENDCLASS(XonoticButton)
16 entity makeXonoticButton(string theText, vector theColor);
17 #endif
18
19 #ifdef IMPLEMENTATION
20 entity makeXonoticButton(string theText, vector theColor)
21 {
22         entity me;
23         me = spawnXonoticButton();
24         me.configureXonoticButton(me, theText, theColor);
25         return me;
26 }
27
28 void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor)
29 {
30         if(theColor == '0 0 0')
31         {
32                 me.configureButton(me, theText, me.fontSize, me.image);
33         }
34         else
35         {
36                 me.configureButton(me, theText, me.fontSize, me.grayImage);
37                 me.color = theColor;
38                 me.colorC = theColor;
39                 me.colorF = theColor;
40         }
41         me.tooltip = getZonedTooltipForIdentifier(strcat(currentDialog.classname, "/", me.text));
42 }
43 #endif