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

Function Text_PaintWithCursor

code/ui/ui_main.cpp:656–675  ·  view source on GitHub ↗

================ Text_PaintWithCursor ================ */ iMaxPixelWidth is 0 here for no-limit

Source from the content-addressed store, hash-verified

654*/
655// iMaxPixelWidth is 0 here for no-limit
656void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int iMaxPixelWidth, int style, int iFontIndex)
657{
658 Text_Paint(x, y, scale, color, text, iMaxPixelWidth, style, iFontIndex);
659
660 // now print the cursor as well...
661 //
662 char sTemp[1024];
663 int iCopyCount = iMaxPixelWidth > 0 ? Q_min( (int)strlen( text ), iMaxPixelWidth ) : (int)strlen( text );
664 iCopyCount = Q_min(iCopyCount, cursorPos);
665 iCopyCount = Q_min(iCopyCount,(int)sizeof(sTemp));
666
667 // copy text into temp buffer for pixel measure...
668 //
669 strncpy(sTemp,text,iCopyCount);
670 sTemp[iCopyCount] = '\0';
671
672 int iNextXpos = ui.R_Font_StrLenPixels(sTemp, iFontIndex, scale );
673
674 Text_Paint(x+iNextXpos, y, scale, color, va("%c",cursor), iMaxPixelWidth, style|ITEM_TEXTSTYLE_BLINK, iFontIndex);
675}
676
677
678const char *UI_FeederItemText(float feederID, int index, int column, qhandle_t *handle)

Callers

nothing calls this directly

Calls 2

Text_PaintFunction · 0.70
vaFunction · 0.50

Tested by

no test coverage detected