MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Item_TextField_Paint

Function Item_TextField_Paint

code/ui/ui_shared.cpp:6483–6523  ·  view source on GitHub ↗

================= Item_TextField_Paint ================= */

Source from the content-addressed store, hash-verified

6481=================
6482*/
6483void Item_TextField_Paint(itemDef_t *item)
6484{
6485 char buff[1024];
6486 vec4_t newColor, lowLight;
6487 int offset;
6488 menuDef_t *parent = (menuDef_t*)item->parent;
6489 editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
6490
6491 Item_Text_Paint(item);
6492
6493 buff[0] = '\0';
6494
6495 if (item->cvar)
6496 {
6497 DC->getCVarString(item->cvar, buff, sizeof(buff));
6498 }
6499
6500 if (item->window.flags & WINDOW_HASFOCUS)
6501 {
6502 lowLight[0] = 0.8 * parent->focusColor[0];
6503 lowLight[1] = 0.8 * parent->focusColor[1];
6504 lowLight[2] = 0.8 * parent->focusColor[2];
6505 lowLight[3] = 0.8 * parent->focusColor[3];
6506 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
6507 }
6508 else
6509 {
6510 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
6511 }
6512
6513 offset = 8;//(item->text && *item->text) ? 8 : 0;
6514 if (item->window.flags & WINDOW_HASFOCUS && g_editingField)
6515 {
6516 char cursor = DC->getOverstrikeMode() ? '_' : '|';
6517 DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset , cursor, /*editPtr->maxPaintChars*/ item->window.rect.w, item->textStyle, item->font);
6518 }
6519 else
6520 {
6521 DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, /*editPtr->maxPaintChars*/ item->window.rect.w, item->textStyle, item->font);
6522 }
6523}
6524
6525void Item_TextScroll_Paint(itemDef_t *item)
6526{

Callers 1

Item_PaintFunction · 0.70

Calls 2

Item_Text_PaintFunction · 0.70
LerpColorFunction · 0.70

Tested by

no test coverage detected