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

Function Item_Text_Paint

code/ui/ui_shared.cpp:6376–6445  ·  view source on GitHub ↗

================= Menu_Paint ================= */

Source from the content-addressed store, hash-verified

6374=================
6375*/
6376void Item_Text_Paint(itemDef_t *item)
6377{
6378 char text[1024];
6379 const char *textPtr;
6380 int height, width;
6381 vec4_t color;
6382
6383 if (item->window.flags & WINDOW_WRAPPED)
6384 {
6385 Item_Text_Wrapped_Paint(item);
6386 return;
6387 }
6388
6389 if (item->window.flags & WINDOW_AUTOWRAPPED)
6390 {
6391 Item_Text_AutoWrapped_Paint(item);
6392 return;
6393 }
6394
6395 if (item->text == NULL)
6396 {
6397 if (item->cvar == NULL)
6398 {
6399 return;
6400 }
6401 else
6402 {
6403 DC->getCVarString(item->cvar, text, sizeof(text));
6404 textPtr = text;
6405 }
6406 }
6407 else
6408 {
6409 textPtr = item->text;
6410 }
6411#ifdef JK2_MODE
6412 if (*textPtr == '@')
6413 {
6414 textPtr = JK2SP_GetStringTextString(&textPtr[1]);
6415 }
6416#else
6417 if (*textPtr == '@') // string reference
6418 {
6419 textPtr = SE_GetString( &textPtr[1] );
6420 }
6421#endif
6422
6423 // this needs to go here as it sets extents for cvar types as well
6424 Item_SetTextExtents(item, &width, &height, textPtr);
6425
6426 if (*textPtr == '\0')
6427 {
6428 return;
6429 }
6430
6431 Item_TextColor(item, &color);
6432 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, textPtr, 0, item->textStyle, item->font);
6433

Callers 7

Item_TextField_PaintFunction · 0.70
Item_Bind_PaintFunction · 0.70
Item_OwnerDraw_PaintFunction · 0.70
Item_YesNo_PaintFunction · 0.70
Item_Multi_PaintFunction · 0.70
Item_Slider_PaintFunction · 0.70
Item_PaintFunction · 0.70

Calls 6

Item_Text_Wrapped_PaintFunction · 0.70
Item_SetTextExtentsFunction · 0.70
Item_TextColorFunction · 0.70
SE_GetStringFunction · 0.50

Tested by

no test coverage detected