You.i Engine
CYIHud::Section Class Referenceabstract

Detailed Description

A renderable HUD section. A section typically renders only a single bit of information.

Sections are backed by a CYIString member, which is used to determine the width of the section. Section subclasses should render into the provided text member to avoid performing memory allocations.

Note
The text in the backed text member is expected to be in code page 437 format rather than UTF-8 format.

#include <debug/YiHud.h>

Inheritance diagram for CYIHud::Section:

Public Member Functions

 Section (const CYIString &initialText, HudSection sectionType=HudSection::UserSection, const CYIColor &textColor=CYIColor::Named().White)
 
virtual ~Section ()
 
HudSection GetSectionType () const
 
float GetWidth () const
 
virtual void FrameUpdate ()
 
virtual void PeriodicUpdate ()
 
virtual void Draw (CYIGeometryBatch *pGeometryBatch, glm::vec2 topLeft)=0
 

Protected Member Functions

SectionGroupGetParentGroup ()
 

Protected Attributes

CYIString m_text
 
CYIColor m_textColor
 
HudSection m_sectionType
 

Friends

class SectionGroup
 

Constructor & Destructor Documentation

◆ Section()

CYIHud::Section::Section ( const CYIString initialText,
HudSection  sectionType = HudSection::UserSection,
const CYIColor textColor = CYIColor::Named().White 
)

◆ ~Section()

virtual CYIHud::Section::~Section ( )
virtual

Member Function Documentation

◆ Draw()

virtual void CYIHud::Section::Draw ( CYIGeometryBatch pGeometryBatch,
glm::vec2  topLeft 
)
pure virtual

Draws this section at topLeft. The provided pGeometryBatch already has had its Begin() function called.

Implemented in CYIHud::SectionGroup.

◆ FrameUpdate()

virtual void CYIHud::Section::FrameUpdate ( )
inlinevirtual

Updates this section. This function is typically called once per frame. This function is a good entry point to calculate per-frame data (without displaying this data per frame.)

Reimplemented in CYIHud::SectionGroup.

◆ GetParentGroup()

SectionGroup* CYIHud::Section::GetParentGroup ( )
protected

Returns the section group into which this section exists.

◆ GetSectionType()

HudSection CYIHud::Section::GetSectionType ( ) const

Returns the type of this section.

See also
CYIHud::HudSection

◆ GetWidth()

float CYIHud::Section::GetWidth ( ) const

Returns the width of this section. This is calculated from the number of characters in the backed CYIString member and the rendered width of a single character.

Note
If the returned width of the bar is different from the previous call to GetWidth, *pWidthChanged is set to true (if pWidthChanged is non-null.)

◆ PeriodicUpdate()

virtual void CYIHud::Section::PeriodicUpdate ( )
inlinevirtual

Updates this section. This function is typically called once per second. This function is a good entry point to calculate periodic data.

Reimplemented in CYIHud::SectionGroup.

Friends And Related Function Documentation

◆ SectionGroup

friend class SectionGroup
friend

Member Data Documentation

◆ m_sectionType

HudSection CYIHud::Section::m_sectionType
protected

◆ m_text

CYIString CYIHud::Section::m_text
protected

◆ m_textColor

CYIColor CYIHud::Section::m_textColor
protected

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