9 me.configureXonoticColorpicker(me, theTextbox);
15 me.controlledTextbox = theTextbox;
16 me.configureImage(me, me.image);
21 this.mouseDrag(
this, pos);
28 v_x = (v.x - margin.x) / (1 - 2 * margin.x);
29 v_y = (v.y - margin.y) / (1 - 2 * margin.y);
54 pos_x = margin.x + pos.x * (1 - 2 * margin.x);
55 pos_y = margin.y + pos.y * (1 - 2 * margin.y);
64 i = me.controlledTextbox.cursorPos;
65 string theText = me.controlledTextbox.text;
71 int new_pos = i - res.y;
73 me.controlledTextbox.setText(me.controlledTextbox, theText);
74 me.controlledTextbox.cursorPos = new_pos;
77 if(
substring(me.controlledTextbox.text, i-1, 1) ==
"^")
80 me.controlledTextbox.enterText(me.controlledTextbox,
"^");
84 margin = me.imagemargin;
85 if(coords.x >= margin.x)
86 if(coords.y >= margin.y)
87 if(coords.x <= 1 - margin.x)
88 if(coords.y <= 1 - margin.y)
97 me.mouseDrag(me, coords);
103 me.controlledTextbox.saveCvars(me.controlledTextbox);
107 return me.controlledTextbox.keyDown(me.controlledTextbox, key, ascii, shift);
114 C =
cvar(
"r_textcontrast");
115 B =
cvar(
"r_textbrightness");
122 C =
bound(0, C, 1-B);
124 aC = 1 - C / (1 - B);
void XonoticColorpicker_configureXonoticColorpicker(entity me, entity theTextbox)
ERASEABLE vector hsl_to_rgb(vector hsl)
void XonoticColorpicker_focusLeave(entity me)
ERASEABLE bool isCaretEscaped(string theText, float pos)
ERASEABLE vector rgb_to_hsl(vector rgb)
#define METHOD(cname, name, prototype)
float XonoticColorpicker_mouseDrag(entity me, vector coords)
float XonoticColorpicker_keyDown(entity me, float key, float ascii, float shift)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void XonoticColorpicker_draw(entity me)
vector hslimage_color(vector v, vector margin)
float XonoticColorpicker_mouseRelease(entity me, vector coords)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity makeXonoticColorpicker(entity theTextbox)
ERASEABLE vector checkColorCode(string theText, int text_len, int pos, bool check_at_the_end)
vector color_hslimage(vector v, vector margin)
ERASEABLE string rgb_to_hexcolor(vector rgb)