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)
211 float save = me.scrollPos;
212 me.scrollPos =
bound(cursorPosInWidths - (0.875 - me.keepspaceLeft - me.keepspaceRight), me.scrollPos, cursorPosInWidths - 0.125);
213 if (me.scrollPos != save) me.dragScrollTimer =
time + 0.2;
215 me.scrollPos =
min(me.scrollPos, totalSizeInWidths - (1 - me.keepspaceRight - me.keepspaceLeft));
216 me.scrollPos =
max(0, me.scrollPos);
219 if (me.editColorCodes)
221 vector p = me.realOrigin -
eX * me.scrollPos;
222 vector theColor =
'1 1 1';
225 for (
int i = 0, n =
strlen(me.text); i < n; ++i)
231 string ch2 =
substring(me.text, i + 1, 1);
233 float fill_alpha = 0.4;
236 if (me.cursorPos > i && me.cursorPos <= i + 2)
238 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
239 draw_Text(p +
eX * 0.25 * w,
"^", me.realFontSize, theColor, theAlpha, 0);
246 case 0: theColor =
'0 0 0';
break;
247 case 1: theColor =
'1 0 0';
break;
248 case 2: theColor =
'0 1 0';
break;
249 case 3: theColor =
'1 1 0';
break;
250 case 4: theColor =
'0 0 1';
break;
251 case 5: theColor =
'0 1 1';
break;
252 case 6: theColor =
'1 0 1';
break;
253 case 7: theColor =
'1 1 1';
break;
254 case 8: theColor =
'1 1 1'; theAlpha = 0.5;
break;
255 case 9: theColor =
'0.5 0.5 0.5';
break;
257 if (me.cursorPos > i && me.cursorPos <= i + 2)
259 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
269 theTempColor.x = component / 15;
274 theTempColor.y = component / 15;
279 theTempColor.z = component / 15;
280 theColor = theTempColor;
283 if (me.cursorPos > i && me.cursorPos <= i + 5)
285 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
317 draw_Fill(p,
eX * w +
eY * me.realFontSize.y,
'1 1 1', fill_alpha);
324 draw_Text(p, ch, me.realFontSize, theColor, theAlpha, 0);
330 draw_Text(me.realOrigin -
eX * me.scrollPos, me.text, me.realFontSize,
'1 1 1', 1, 0);
333 if (!me.focused || (
time - me.lastChangeTime) <
floor(
time - me.lastChangeTime) + 0.5)
334 draw_Text(me.realOrigin +
eX * (cursorPosInWidths - me.scrollPos), CURSOR, me.realFontSize,
'1 1 1', 1, 0);
338 if (me.enableClearButton && me.text !=
"")
340 if (me.focused && me.cb_pressed)
341 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_c"),
eX * me.cb_width +
eY, me.cb_colorC, 1);
342 else if (me.focused && me.cb_focused)
343 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_f"),
eX * me.cb_width +
eY, me.cb_colorF, 1);
345 draw_Picture(
eX * (1 + me.cb_offset - me.cb_width),
strcat(me.cb_src,
"_n"),
eX * me.cb_width +
eY, me.cb_color, 1);