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

Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings. *UICanvas acts as the graphics compositor for the UI layer. It intercepts layout draw commands, pools transient vertex lists into unified buffers to optimize pipeline state swaps, and coordinates a sliding frame cache system that automatically tracks and flushes unreferenced font textures from VRAM. More...

#include <flint/ui/ui-canvas.h>

+ Collaboration diagram for Flint::UICanvas:

Public Member Functions

 UICanvas (GPURenderer &renderer)
 Binds the UI renderer subsystem to the master application graphics context layout tree.
 
 UICanvas (const UICanvas &)=delete
 
UICanvas & operator= (const UICanvas &)=delete
 
void emit (RenderQueue &queue)
 
void uploadGeometry (SDL_GPUCommandBuffer *cmd)
 Pass 1 of the render loop: Synchronizes local vertex lists down to the physical GPU VRAM.
 
void flushDrawCalls (SDL_GPURenderPass *renderPass, SDL_GPUCommandBuffer *commandBuffer)
 Pass 2 of the render loop: Binds graphics pipelines and triggers draw execution commands.
 
void setScreenSize (Vec2f size)
 Syncs internal display bounding metrics to transform absolute screen pixel bounds cleanly.
 
void drawRect (Rect< float > rect, Color color)
 Submits a flat quad drawing sequence down to the current active runtime pipeline layer.
 
void drawText (std::string text, float x, float y, float fontSize, Color color, std::string fontName="", uint16_t weight=400)
 Enqueues a string draw command record to be processed during the geometry generation pass.
 
void drawTexture (const GPUTexture &texture, Rect< float > rect, Color tint={255, 255, 255, 255})
 Appends a geometric quad textured draw record down to the dynamic vertex batch structure arrays.
 
Vec2f getScreenSize () const
 Returns the active window coordinates representing the screen boundaries.
 
Vec2f measureText (const std::string &text, float fontSize, const std::string &fontName="", uint16_t weight=400)
 Calculates structural spatial dimensions a text block requires before executing layout renders.
 
float getGlyphCenterOffset (const std::string &text, float fontSize, const std::string &fontName="", uint16_t weight=400)
 
bool loadFont (std::vector< char > &&data, const std::string &fontName, uint16_t weight=400)
 Registers raw binary TTF font file data into the subsystem memory allocator.
 
void setDefaultFont (const std::string &name)
 Assigns the base default fallback typography name token.
 
void discardDrawCalls ()
 Instantly clears local staging arrays, abandoning all un-flushed vector and character draw steps.
 

Detailed Description

Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings. *UICanvas acts as the graphics compositor for the UI layer. It intercepts layout draw commands, pools transient vertex lists into unified buffers to optimize pipeline state swaps, and coordinates a sliding frame cache system that automatically tracks and flushes unreferenced font textures from VRAM.

Definition at line 106 of file ui-canvas.h.


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