2 CLASS(NexuizColorButton) EXTENDS(RadioButton)
3 METHOD(NexuizColorButton, configureNexuizColorButton, void(entity, float, float, float))
4 METHOD(NexuizColorButton, setChecked, void(entity, float))
5 METHOD(NexuizColorButton, draw, void(entity))
6 ATTRIB(NexuizColorButton, fontSize, float, SKINFONTSIZE_NORMAL)
7 ATTRIB(NexuizColorButton, image, string, SKINGFX_COLORBUTTON)
8 ATTRIB(NexuizColorButton, image2, string, SKINGFX_COLORBUTTON_COLOR)
10 ATTRIB(NexuizColorButton, useDownAsChecked, float, 1)
12 ATTRIB(NexuizColorButton, cvarPart, float, 0)
13 ATTRIB(NexuizColorButton, cvarName, string, string_null)
14 ATTRIB(NexuizColorButton, cvarValueFloat, float, 0)
15 METHOD(NexuizColorButton, loadCvars, void(entity))
16 METHOD(NexuizColorButton, saveCvars, void(entity))
18 ATTRIB(NexuizColorButton, disabledAlpha, float, SKINALPHA_DISABLED)
19 ENDCLASS(NexuizColorButton)
20 entity makeNexuizColorButton(float, float, float);
24 entity makeNexuizColorButton(float theGroup, float theColor, float theValue)
27 me = spawnNexuizColorButton();
28 me.configureNexuizColorButton(me, theGroup, theColor, theValue);
31 void configureNexuizColorButtonNexuizColorButton(entity me, float theGroup, float theColor, float theValue)
33 me.cvarName = "_cl_color";
34 me.cvarValueFloat = theValue;
35 me.cvarPart = theColor;
37 me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);
41 void setCheckedNexuizColorButton(entity me, float val)
49 void loadCvarsNexuizColorButton(entity me)
52 me.checked = (cvar(me.cvarName) & 240) == me.cvarValueFloat * 16;
54 me.checked = (cvar(me.cvarName) & 15) == me.cvarValueFloat;
56 void saveCvarsNexuizColorButton(entity me)
61 cvar_set(me.cvarName, ftos(cvar(me.cvarName) & 15 + me.cvarValueFloat * 16));
63 cvar_set(me.cvarName, ftos(cvar(me.cvarName) & 240 + me.cvarValueFloat));
65 // TODO on an apply button, read _cl_color and execute the color command for it
67 void drawNexuizColorButton(entity me)
69 me.color2 = colormapPaletteColor(me.cvarValueFloat, me.cvarPart);