Skip to content

UILabel ​

Class

Source: UILabel.h

Inherits from: UIElement

Description ​

A simple text label UI element.

Displays a string of text on the screen. Auto-calculates its bounds based on text length and size.

Inheritance ​

UIElement → UILabel

Methods ​

void setText(std::string_view t) ​

Description:

Updates the label's text. Recalculates dimensions if text changes.

Parameters:

  • t: New text.

void setVisible(bool v) ​

Description:

Sets visibility.

Parameters:

  • v: True to show, false to hide.

void centerX(int screenWidth) ​

Description:

Centers the label horizontally on the screen.

Parameters:

  • screenWidth: Width of the screen/container.

void update(unsigned long deltaTime) ​

void draw(pixelroot32::graphics::Renderer& renderer) ​

void recalcSize() ​

Description:

Recalculates width and height based on current text and font size.

Released under the MIT License.