9 me.configureXonoticColorpicker(me, theTextbox);
15 me.controlledTextbox = theTextbox;
16 me.configureImage(me, me.image);
27 v.x = (v.x - margin.x) / (1 - 2 * margin.x);
28 v.y = (v.y - margin.y) / (1 - 2 * margin.y);
55 pos.x = margin.x + pos.x * (1 - 2 * margin.x);
56 pos.y = margin.y + pos.y * (1 - 2 * margin.y);
65 i = me.controlledTextbox.cursorPos;
66 string theText = me.controlledTextbox.text;
72 int new_pos = i - res.y;
74 me.controlledTextbox.setText(me.controlledTextbox, theText);
75 me.controlledTextbox.cursorPos = new_pos;
78 if(
substring(me.controlledTextbox.text, i-1, 1) ==
"^")
81 me.controlledTextbox.enterText(me.controlledTextbox,
"^");
85 margin = me.imagemargin;
86 if(coords.x >= margin.x)
87 if(coords.y >= margin.y)
88 if(coords.x <= 1 - margin.x)
89 if(coords.y <= 1 - margin.y)
98 me.mouseDrag(me, coords);
104 me.controlledTextbox.saveCvars(me.controlledTextbox);
108 return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
115 C =
cvar(
"r_textcontrast");
116 B =
cvar(
"r_textbrightness");
123 C =
bound(0, C, 1-B);
125 aC = 1 - C / (1 - B);
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void mousePress()
ERASEABLE string rgb_to_hexcolor(vector rgb)
ERASEABLE vector rgb_to_hsl(vector rgb)
ERASEABLE vector hsl_to_rgb(vector hsl)
void XonoticColorpicker_configureXonoticColorpicker(entity me, entity theTextbox)
vector hslimage_color(vector v, vector margin)
entity makeXonoticColorpicker(entity theTextbox)
void XonoticColorpicker_draw(entity me)
float XonoticColorpicker_mouseDrag(entity me, vector coords)
float XonoticColorpicker_keyDown(entity me, float key, float ascii, float shift)
float XonoticColorpicker_mouseRelease(entity me, vector coords)
vector color_hslimage(vector v, vector margin)
void XonoticColorpicker_focusLeave(entity me)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define METHOD(cname, name, prototype)
ERASEABLE bool isCaretEscaped(string theText, float pos)
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)