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::draw Namespace Reference

Functions

void clearColor (asw::Color color)
 Clear the screen to a color.
 
void sprite (const asw::Texture &tex, const asw::Vec2< float > &position)
 Draw a sprite.
 
void spriteFlip (const asw::Texture &tex, const asw::Vec2< float > &position, bool flipX, bool flipY)
 Draw a sprite with the option to flip it.
 
void stretchSprite (const asw::Texture &tex, const asw::Quad< float > &position)
 Draw a sprite with the option to stretch it.
 
void rotateSprite (const asw::Texture &tex, const asw::Vec2< float > &position, double angle)
 Draw a sprite with the option to rotate it.
 
void stretchSpriteBlit (const asw::Texture &tex, const asw::Quad< float > &source, const asw::Quad< float > &dest)
 Draw a sprite with the option to stretch a portion of it.
 
void stretchSpriteRotateBlit (const asw::Texture &tex, const asw::Quad< float > &source, const asw::Quad< float > &dest, double angle)
 Draw a sprite with the option to stretch and rotate a portion of it.
 
void text (const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
 Draw text left aligned.
 
void textCenter (const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
 Draw text center aligned.
 
void textRight (const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
 Draw text right aligned.
 
void point (const asw::Vec2< float > &position, asw::Color color)
 Draw a point.
 
void line (const asw::Vec2< float > &position1, const asw::Vec2< float > &position2, asw::Color color)
 Draw a line.
 
void rect (const asw::Quad< float > &position, asw::Color color)
 Draw a rectangle.
 
void rectFill (const asw::Quad< float > &position, asw::Color color)
 Draw a filled rectangle.
 
void circle (const asw::Vec2< float > &position, float radius, asw::Color color)
 Draw a circle.
 
void circleFill (const asw::Vec2< float > &position, float radius, asw::Color color)
 Draw a filled circle.
 
void setBlendMode (const asw::Texture &texture, asw::BlendMode mode)
 Set the blend mode of a texture.
 
void setAlpha (const asw::Texture &texture, float alpha)
 Set the alpha of a texture.
 

Function Documentation

◆ circle()

void asw::draw::circle ( const asw::Vec2< float > & position,
float radius,
asw::Color color )

Draw a circle.

Parameters
positionThe position of the center of the circle.
radiusThe radius of the circle.
colorThe color of the circle.

Definition at line 202 of file draw.cpp.

◆ circleFill()

void asw::draw::circleFill ( const asw::Vec2< float > & position,
float radius,
asw::Color color )

Draw a filled circle.

Parameters
positionThe position of the center of the circle.
radiusThe radius of the circle.
colorThe color of the circle.

Definition at line 214 of file draw.cpp.

◆ clearColor()

void asw::draw::clearColor ( asw::Color color)

Clear the screen to a color.

Parameters
colorThe color to clear the screen to.

Definition at line 11 of file draw.cpp.

◆ line()

void asw::draw::line ( const asw::Vec2< float > & position1,
const asw::Vec2< float > & position2,
asw::Color color )

Draw a line.

Parameters
position1The starting position of the line.
position2The ending position of the line.
colorThe color of the line.

Definition at line 169 of file draw.cpp.

◆ point()

void asw::draw::point ( const asw::Vec2< float > & position,
asw::Color color )

Draw a point.

Parameters
positionThe position of the point.
colorThe color of the point.

Definition at line 163 of file draw.cpp.

◆ rect()

void asw::draw::rect ( const asw::Quad< float > & position,
asw::Color color )

Draw a rectangle.

Parameters
positionThe quad defining the position and size of the rectangle.
colorThe color of the rectangle.

Definition at line 178 of file draw.cpp.

◆ rectFill()

void asw::draw::rectFill ( const asw::Quad< float > & position,
asw::Color color )

Draw a filled rectangle.

Parameters
positionThe quad defining the position and size of the rectangle.
colorThe color of the rectangle.

Definition at line 190 of file draw.cpp.

◆ rotateSprite()

void asw::draw::rotateSprite ( const asw::Texture & tex,
const asw::Vec2< float > & position,
double angle )

Draw a sprite with the option to rotate it.

Parameters
texThe texture to draw.
positionThe position to draw the sprite at.
angleThe angle to rotate the sprite by in degrees.

Definition at line 67 of file draw.cpp.

◆ setAlpha()

void asw::draw::setAlpha ( const asw::Texture & texture,
float alpha )

Set the alpha of a texture.

Parameters
textureThe texture to set the alpha of.
alphaThe alpha to set.

Definition at line 230 of file draw.cpp.

◆ setBlendMode()

void asw::draw::setBlendMode ( const asw::Texture & texture,
asw::BlendMode mode )

Set the blend mode of a texture.

Parameters
textureThe texture to set the blend mode of.
modeThe blend mode to set.

Definition at line 226 of file draw.cpp.

◆ sprite()

void asw::draw::sprite ( const asw::Texture & tex,
const asw::Vec2< float > & position )

Draw a sprite.

Parameters
texThe texture to draw.
positionThe position to draw the sprite at.

Definition at line 17 of file draw.cpp.

◆ spriteFlip()

void asw::draw::spriteFlip ( const asw::Texture & tex,
const asw::Vec2< float > & position,
bool flipX,
bool flipY )

Draw a sprite with the option to flip it.

Parameters
texThe texture to draw.
positionThe position to draw the sprite at.
flipXWhether or not to flip the sprite on the x axis.
flipYWhether or not to flip the sprite on the y axis.

Definition at line 30 of file draw.cpp.

◆ stretchSprite()

void asw::draw::stretchSprite ( const asw::Texture & tex,
const asw::Quad< float > & position )

Draw a sprite with the option to stretch it.

Parameters
texThe texture to draw.
positionThe quad defining the position and size to stretch the sprite to.

Definition at line 56 of file draw.cpp.

◆ stretchSpriteBlit()

void asw::draw::stretchSpriteBlit ( const asw::Texture & tex,
const asw::Quad< float > & source,
const asw::Quad< float > & dest )

Draw a sprite with the option to stretch a portion of it.

Parameters
texThe texture to draw.
sourceThe quad defining the portion of the texture to stretch.
destThe quad defining the position and size to stretch the sprite to.

Definition at line 82 of file draw.cpp.

◆ stretchSpriteRotateBlit()

void asw::draw::stretchSpriteRotateBlit ( const asw::Texture & tex,
const asw::Quad< float > & source,
const asw::Quad< float > & dest,
double angle )

Draw a sprite with the option to stretch and rotate a portion of it.

Parameters
texThe texture to draw.
sourceThe quad defining the portion of the texture to stretch.
destThe quad defining the position and size to stretch the sprite to.
angleThe angle to rotate the sprite by in degrees.

Definition at line 100 of file draw.cpp.

◆ text()

void asw::draw::text ( const asw::Font & font,
const std::string & text,
const asw::Vec2< float > & position,
asw::Color color )

Draw text left aligned.

Parameters
fontThe font to use.
textThe text to draw.
positionThe position to draw the text at.
colorThe color to draw the text.

Definition at line 120 of file draw.cpp.

◆ textCenter()

void asw::draw::textCenter ( const asw::Font & font,
const std::string & text,
const asw::Vec2< float > & position,
asw::Color color )

Draw text center aligned.

Parameters
fontThe font to use.
textThe text to draw.
positionThe position to draw the text at.
colorThe color to draw the text.

Definition at line 146 of file draw.cpp.

◆ textRight()

void asw::draw::textRight ( const asw::Font & font,
const std::string & text,
const asw::Vec2< float > & position,
asw::Color color )

Draw text right aligned.

Parameters
fontThe font to use.
textThe text to draw.
positionThe position to draw the text at.
colorThe color to draw the text.

Definition at line 155 of file draw.cpp.