Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::UISprite Class Reference

A static texture rendering frame component wrapper. More...

#include <flint/ui/widgets/sprite.h>

+ Inheritance diagram for Flint::UISprite:
+ Collaboration diagram for Flint::UISprite:

Public Member Functions

 UISprite (GPUTexture &texture)
 Hooks the sprite wrapper directly to a non-owning raw handle texture resource asset.
 
void setTexture (GPUTexture &texture)
 
void measure (UIConstraints constraints) override
 Pass 1 of the layout engine: Crawls branches recursively to compute base display boundaries requested by child assets.
 
void arrange (const Rect< float > &rect) override
 Pass 2 of the layout engine: Evaluates layout adjustments to pin final screen coordinate values to the tree structures.
 
void render (UICanvas &canvas) const override
 Pushes current styling rules and geometries straight down to the active pipeline vertex drawing queue arrays.
 
- Public Member Functions inherited from Flint::UINode
void setContext (UIContext *context)
 Recursively propagates a pointer back to the parent-managing workspace layer.
 
void addChild (std::unique_ptr< UINode > child)
 Inserts a child widget to live inside this layout element container boundary.
 
void setPosition (Vec2f position)
 Updates the relative local rendering position coordinates of this element block.
 
Vec2f getPosition () const
 Get the node's relative local position.
 
void setSize (Vec2f size)
 Assigns a manual static override layout budget footprint dimensions limit.
 
Vec2f getSize () const
 Get the node's base size.
 
void setVisible (bool visible)
 Sets widget visibility.
 
void setEnabled (bool enabled)
 Enables or disables user interaction for this widget.
 
void setID (std::string id)
 Sets a unique string identifier for this node.
 
const std::string & getId () const
 Gets the unique lookup ID string of this node.
 
const Rect< float > & getLayoutRect () const
 Gets the final screen-space bounding box calculated during the arrange pass.
 
bool isVisible () const
 
bool isEnabled () const
 
Vec2f getDesiredSize () const
 Get the node's requested size from the measure pass.
 
const std::vector< std::unique_ptr< UINode > > & getChildren () const
 Get the list of this node's child nodes.
 
virtual void setFocused (bool focused)
 Sets whether this node is currently focused.
 
void setText (std::string text)
 Sets the text content for widgets that display text.
 
const std::string & getText () const
 Gets the current text content of the widget.
 
void setFontSize (uint16_t fontSize)
 Set the rendering font size in points.
 
uint16_t getFontSize () const
 
void setColor (Color color)
 Sets the base color of the widget.
 
Color getColor () const
 
virtual void setNormalColor (Color color)
 Sets the base color of the widget.
 
virtual void setActiveColor (Color color)
 Sets visual colors used when inputs hover across or lock selections on the widget container.
 
virtual void handleEvent (const UIEvent &event)
 Traverses active child collections to pass translated physical hardware inputs down to focused widgets.
 
virtual bool isFocusable () const
 Dictates if keyboard selection trackers or gamepad vectors can snap control focuses onto this item.
 
virtual bool hitTest (Vec2f point) const
 Computes true if a vector coordinate sits inside the spatial arrangement bounding tracking layout box.
 
void setFont (std::string name)
 Assigns a custom typography description token mapping back to cached font elements.
 
void setFontWeight (uint16_t weight)
 Assigns thickness parameters across structural type vectors (e.g., 400 for regular, 700 for bold).
 
void setTextOpticalBias (float bias)
 
float getTextOpticalBias () const
 
virtual bool consumesDirectionalInput () const
 Dictates whether this widget captures directional inputs instead of passing them to focus navigation.
 
bool isFocused () const
 
void setHorizontalAlign (UIAlign align)
 
void setVerticalAlign (UIAlign align)
 
UIAlign getHorizontalAlign () const
 
UIAlign getVerticalAlign () const
 
void setLayoutGrow (float grow)
 Assigns dynamic expansion multipliers used to balance alignment distributions inside sequential layout panels.
 
float getLayoutGrow () const
 Gets the dynamic expansion weight used inside stack layout grids.
 

Additional Inherited Members

- Protected Member Functions inherited from Flint::UINode
virtual const Color & currentColor () const
 Dynamically picks active color metrics using real-time interaction states.
 
- Protected Attributes inherited from Flint::UINode
std::string m_id
 
UINode * m_parent = nullptr
 
std::vector< std::unique_ptr< UINode > > m_children
 
Vec2f m_localPosition {}
 
Vec2f m_desiredSize {}
 
Vec2f m_baseSize {}
 
Rect< float > m_layoutRect {}
 
bool m_visible = true
 
bool m_enabled = true
 
float m_displayScale = 1.0f
 
std::string m_fontName
 
uint16_t m_fontWeight = 400
 
uint16_t m_fontSize = 16
 
float m_textOpticalBias = 0.f
 
std::string m_text
 
Color m_normalColor = Colors::white
 
Color m_activeColor = {0, 255, 0, 255}
 
bool m_hovered = false
 
bool m_focused = false
 
UIAlign m_horizontalAlign = UIAlign::Stretch
 
UIAlign m_verticalAlign = UIAlign::Start
 
float m_layoutGrow = 0.f
 

Detailed Description

A static texture rendering frame component wrapper.

  • Wraps around a backend GPUTexture allocation reference. Upon instantiation, it extracts width and height metrics from the textures to establish its base layout sizing bounds.

Definition at line 16 of file sprite.h.


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