ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::util Namespace Reference

Functions

void abort_on_error (const std::string &message)
 Abort program and display error message.
 
asw::Vec2< float > get_texture_size (const asw::Texture &tex)
 Get texture size.
 
asw::Vec2< int > get_text_size (const asw::Font &font, const std::string &text)
 Get text size.
 
void clear_text_size_cache ()
 Clear cached text metrics.
 
template<typename T >
lerp (const T &a, const T &b, float t)
 Lerp between two values.
 

Function Documentation

◆ abort_on_error()

void asw::util::abort_on_error ( const std::string & message)

Abort program and display error message.

Parameters
messageMessage to display

Definition at line 30 of file util.cpp.

◆ clear_text_size_cache()

void asw::util::clear_text_size_cache ( )

Clear cached text metrics.

Text size caching is shared across widgets and text drawing helpers, so it should be cleared when font resources are unloaded.

Definition at line 70 of file util.cpp.

◆ get_text_size()

asw::Vec2< int > asw::util::get_text_size ( const asw::Font & font,
const std::string & text )

Get text size.

Parameters
fontFont to use
textText to get size of
Returns
Size as Vec2

Definition at line 44 of file util.cpp.

◆ get_texture_size()

asw::Vec2< float > asw::util::get_texture_size ( const asw::Texture & tex)

Get texture size.

Parameters
texTexture to get size of
Returns
Size as Vec2

Definition at line 37 of file util.cpp.

◆ lerp()

template<typename T >
T asw::util::lerp ( const T & a,
const T & b,
float t )

Lerp between two values.

Parameters
aStart value
bEnd value
tInterpolation value (0-1)
Returns
Interpolated value

Definition at line 56 of file util.h.