DDNet documentation
Loading...
Searching...
No Matches
CCachedText Class Reference

#include <ui.h>

Collaboration diagram for CCachedText:
[legend]

Public Member Functions

 CCachedText ()=default
 CCachedText (const CCachedText &)=delete
CCachedTextoperator= (const CCachedText &)=delete
void Update (ITextRender *pTextRender, const char *pText, float FontSize, float LineWidth=-1.0f, int CursorFlags=TEXTFLAG_RENDER)
void Render (ITextRender *pTextRender, vec2 Pos, ColorRGBA Color) const
void Reset (ITextRender *pTextRender)
float Width () const
float MaxCharacterHeight () const

Private Attributes

STextContainerIndex m_TextContainerIndex
std::string m_Text
float m_FontSize = -1.0f
float m_LineWidth = -1.0f
int m_CursorFlags = 0
STextBoundingBox m_BoundingBox = {0.0f, 0.0f, 0.0f, 0.0f}
float m_MaxCharacterHeight = 0.0f

Detailed Description

Text that keeps its text container across frames and is only rebuilt when the text or its layout changes, for text that is rendered every frame. The color is applied when rendering, so changing it does not rebuild the container.

The container must be released with Reset before the text render drops its containers, which happens on window resize and language change.

Constructor & Destructor Documentation

◆ CCachedText() [1/2]

CCachedText::CCachedText ( )
default

◆ CCachedText() [2/2]

CCachedText::CCachedText ( const CCachedText & )
delete

Member Function Documentation

◆ MaxCharacterHeight()

float CCachedText::MaxCharacterHeight ( ) const
inline

◆ operator=()

CCachedText & CCachedText::operator= ( const CCachedText & )
delete

◆ Render()

void CCachedText::Render ( ITextRender * pTextRender,
vec2 Pos,
ColorRGBA Color ) const

◆ Reset()

void CCachedText::Reset ( ITextRender * pTextRender)

◆ Update()

void CCachedText::Update ( ITextRender * pTextRender,
const char * pText,
float FontSize,
float LineWidth = -1.0f,
int CursorFlags = TEXTFLAG_RENDER )

◆ Width()

float CCachedText::Width ( ) const
inline

Member Data Documentation

◆ m_BoundingBox

STextBoundingBox CCachedText::m_BoundingBox = {0.0f, 0.0f, 0.0f, 0.0f}
private

◆ m_CursorFlags

int CCachedText::m_CursorFlags = 0
private

◆ m_FontSize

float CCachedText::m_FontSize = -1.0f
private

◆ m_LineWidth

float CCachedText::m_LineWidth = -1.0f
private

◆ m_MaxCharacterHeight

float CCachedText::m_MaxCharacterHeight = 0.0f
private

◆ m_Text

std::string CCachedText::m_Text
private

◆ m_TextContainerIndex

STextContainerIndex CCachedText::m_TextContainerIndex
private

The documentation for this class was generated from the following files: