135 me.lastChangeTime =
time;
136 me.dragScrollTimer =
time;
137 if (ascii >= 32 && ascii != 127)
139 me.enterText(me,
chr(ascii));
141 me.applyButton.disabled =
false;
160 me.cursorPos =
strlen(me.text);
163 if (me.cursorPos > 0)
168 me.applyButton.disabled =
false;
181 me.applyButton.disabled =
false;
190 float cursorPosInWidths, totalSizeInWidths;
192 if (me.pressed) me.mouseDrag(me, me.dragScrollPos);
194 if (me.recalcPos) me.recalcPositionWithText(me, me.text);
196 me.focusable = !me.disabled;
197 if (me.disabled)
draw_alpha *= me.disabledAlpha;
205 me.cursorPos =
bound(0, me.cursorPos,
strlen(me.text));
209 if (me.dragScrollTimer <
time)
213 me.scrollPos =
bound(cursorPosInWidths - (0.875 - me.keepspaceLeft - me.keepspaceRight), me.scrollPos, cursorPosInWidths - 0.125);
214 if (me.scrollPos != save) me.dragScrollTimer =
time + 0.2;
216 me.scrollPos =
min(me.scrollPos, totalSizeInWidths - (1 - me.keepspaceRight - me.keepspaceLeft));
217 me.scrollPos =
max(0, me.scrollPos);
220 if (me.editColorCodes)
222 vector p = me.realOrigin -
eX * me.scrollPos;
223 vector theColor =
'1 1 1';
226 for (
int i = 0, n =
strlen(me.text); i < n; ++i)
232 string ch2 =
substring(me.text, i + 1, 1);
234 float fill_alpha = 0.4;
237 if (me.cursorPos > i && me.cursorPos <= i + 2)
239 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
240 draw_Text(p +
eX * 0.25 * w,
"^", me.realFontSize, theColor, theAlpha, 0);
247 case 0: theColor =
'0 0 0';
break;
248 case 1: theColor =
'1 0 0';
break;
249 case 2: theColor =
'0 1 0';
break;
250 case 3: theColor =
'1 1 0';
break;
251 case 4: theColor =
'0 0 1';
break;
252 case 5: theColor =
'0 1 1';
break;
253 case 6: theColor =
'1 0 1';
break;
254 case 7: theColor =
'1 1 1';
break;
255 case 8: theColor =
'1 1 1'; theAlpha = 0.5;
break;
256 case 9: theColor =
'0.5 0.5 0.5';
break;
258 if (me.cursorPos > i && me.cursorPos <= i + 2)
260 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
270 theTempColor.x = component / 15;
275 theTempColor.y = component / 15;
280 theTempColor.z = component / 15;
281 theColor = theTempColor;
284 if (me.cursorPos > i && me.cursorPos <= i + 5)
286 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
318 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
325 draw_Text(p, ch, me.realFontSize, theColor, theAlpha, 0);
331 draw_Text(me.realOrigin -
eX * me.scrollPos, me.text, me.realFontSize,
'1 1 1', 1, 0);
334 if (!me.focused || (
time - me.lastChangeTime) <
floor(
time - me.lastChangeTime) + 0.5)
335 draw_Text(me.realOrigin +
eX * (cursorPosInWidths - me.scrollPos), CURSOR, me.realFontSize,
'1 1 1', 1, 0);
339 if (me.enableClearButton && me.text !=
"")
341 if (me.focused && me.cb_pressed)
342 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_c"),
eX * me.cb_width +
eY, me.cb_colorC, 1);
343 else if (me.focused && me.cb_focused)
344 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_f"),
eX * me.cb_width +
eY, me.cb_colorF, 1);
346 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_n"),
eX * me.cb_width +
eY, me.cb_color, 1);