R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
UI::TextUtils Namespace Reference

Functions

int EstimateTextWidth (const std::string &text, int fontSize)
 Estimate the width of text in pixels.
 

Function Documentation

◆ EstimateTextWidth()

int UI::TextUtils::EstimateTextWidth ( const std::string &  text,
int  fontSize 
)
inline

Estimate the width of text in pixels.

This is a rough approximation based on the assumption that each character is approximately 55% of the font size in width.

Parameters
textText string to measure
fontSizeFont size in pixels
Returns
Estimated width in pixels
Note
This is an approximation and may not be pixel-perfect. For accurate measurements, use Raylib's MeasureText function.

Definition at line 27 of file TextUtils.hpp.

Referenced by Game::LoginMenu::Render(), UI::RaylibButton::Render(), and Rendering::RenderHUD().