]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/button.c
auto-super.pl run
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / button.c
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 ENDCLASS(XonoticButton)
14 entity makeXonoticButton(string theText, vector theColor);
15 #endif
16
17 #ifdef IMPLEMENTATION
18 entity makeXonoticButton(string theText, vector theColor)
19 {
20         entity me;
21         me = spawnXonoticButton();
22         me.configureXonoticButton(me, theText, theColor);
23         return me;
24 }
25
26 void XonoticButton_configureXonoticButton(entity me, string theText, vector theColor)
27 {
28         if(theColor == '0 0 0')
29         {
30                 me.configureButton(me, theText, me.fontSize, me.image);
31         }
32         else
33         {
34                 me.configureButton(me, theText, me.fontSize, me.grayImage);
35                 me.color = theColor;
36                 me.colorC = theColor;
37                 me.colorF = theColor;
38         }
39         me.tooltip = getZonedTooltipForIdentifier(strcat(currentDialog.classname, "/", me.text));
40 }
41 #endif