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

Function Item_Text_AutoWrapped_Paint

code/ui/ui_shared.cpp:8597–8714  ·  view source on GitHub ↗

================= Item_Text_AutoWrapped_Paint ================= */

Source from the content-addressed store, hash-verified

8595=================
8596*/
8597void Item_Text_AutoWrapped_Paint(itemDef_t *item)
8598{
8599 char text[1024];
8600 const char *p, *textPtr, *newLinePtr;
8601 char buff[1024];
8602 int height, len, textWidth, newLine, newLineWidth;
8603 float y;
8604 vec4_t color;
8605
8606 textWidth = 0;
8607 newLinePtr = NULL;
8608
8609 if (item->text == NULL)
8610 {
8611 if (item->cvar == NULL)
8612 {
8613 return;
8614 }
8615 else
8616 {
8617 DC->getCVarString(item->cvar, text, sizeof(text));
8618 textPtr = text;
8619 }
8620 }
8621 else
8622 {
8623 textPtr = item->text;
8624 }
8625 if (*textPtr == '@') // string reference
8626 {
8627 textPtr = SE_GetString( &textPtr[1] );
8628 }
8629
8630 if (*textPtr == '\0')
8631 {
8632 return;
8633 }
8634 Item_TextColor(item, &color);
8635 //Item_SetTextExtents(item, &width, &height, textPtr);
8636 if (item->value == 0)
8637 {
8638 item->value = (int)(0.5 + (float)DC->textWidth(textPtr, item->textscale, item->font) / item->window.rect.w);
8639 }
8640 height = DC->textHeight(textPtr, item->textscale, item->font);
8641 item->special = 0;
8642
8643 y = item->textaligny;
8644 len = 0;
8645 buff[0] = '\0';
8646 newLine = 0;
8647 newLineWidth = 0;
8648 p = textPtr;
8649 int line = 1;
8650 while (1) //findmeste (this will break widechar languages)!
8651 {
8652 if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0')
8653 {
8654 newLine = len;

Callers 1

Item_Text_PaintFunction · 0.70

Calls 3

Item_TextColorFunction · 0.70
ToWindowCoordsFunction · 0.70
SE_GetStringFunction · 0.50

Tested by

no test coverage detected