MCPcopy Create free account
hub / github.com/ddnet/ddnet / DoLabel

Method DoLabel

src/game/client/ui.cpp:796–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794}
795
796CLabelResult CUi::DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps) const
797{
798 const int Flags = GetFlagsForLabelProperties(LabelProps, nullptr);
799 const SCursorAndBoundingBox TextBounds = CalcFontSizeCursorHeightAndBoundingBox(TextRender(), pText, Flags, Size, pRect->w, LabelProps);
800 const vec2 CursorPos = CalcAlignedCursorPos(pRect, TextBounds.m_TextSize, Align, TextBounds.m_LineCount == 1 ? &TextBounds.m_BiggestCharacterHeight : nullptr);
801
802 CTextCursor Cursor;
803 Cursor.SetPosition(CursorPos);
804 Cursor.m_FontSize = Size;
805 Cursor.m_Flags |= Flags;
806 Cursor.m_vColorSplits = LabelProps.m_vColorSplits;
807 Cursor.m_LineWidth = (float)LabelProps.m_MaxWidth;
808 TextRender()->TextEx(&Cursor, pText, -1);
809 return CLabelResult{.m_Truncated = Cursor.m_Truncated};
810}
811
812void CUi::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, const CTextCursor *pReadCursor) const
813{

Calls 12

TextRenderFunction · 0.85
TextExMethod · 0.80
GetTextColorMethod · 0.80
GetTextOutlineColorMethod · 0.80
TextColorMethod · 0.80
DefaultTextColorMethod · 0.80
TextOutlineColorMethod · 0.80
CreateTextContainerMethod · 0.80
SetPositionMethod · 0.45

Tested by

no test coverage detected