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 abortOnError (const std::string &message)
 Abort program and display error message.
 
asw::Color makeColor (int r, int g, int b)
 Make a color from RGB values.
 
asw::Color makeColor (int r, int g, int b, int a)
 Make a color from RGBA values.
 
asw::Vec2< float > getTextureSize (const asw::Texture &tex)
 Get texture size.
 
asw::Vec2< int > getTextSize (const asw::Font &font, const std::string &text)
 Get text size.
 
template<typename T >
lerp (const T &a, const T &b, float t)
 Lerp between two values.
 

Function Documentation

◆ abortOnError()

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

Abort program and display error message.

Parameters
messageMessage to display

Definition at line 6 of file util.cpp.

◆ getTextSize()

asw::Vec2< int > asw::util::getTextSize ( 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 36 of file util.cpp.

◆ getTextureSize()

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

Get texture size.

Parameters
texTexture to get size of
Returns
Size as Vec2

Definition at line 30 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 68 of file util.h.

◆ makeColor() [1/2]

asw::Color asw::util::makeColor ( int r,
int g,
int b )

Make a color from RGB values.

Parameters
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)
Returns
The color

Definition at line 12 of file util.cpp.

◆ makeColor() [2/2]

asw::Color asw::util::makeColor ( int r,
int g,
int b,
int a )

Make a color from RGBA values.

Parameters
rRed value (0-255)
gGreen value (0-255)
bBlue value (0-255)
aAlpha value (0-255)
Returns
The color

Definition at line 21 of file util.cpp.