|
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++.
|
Functions | |
| void | clear_color (asw::Color color) |
| Clear the screen to a color. | |
| void | sprite (const asw::Texture &tex, const asw::Vec2< float > &position) |
| Draw a sprite. | |
| void | sprite_flip (const asw::Texture &tex, const asw::Vec2< float > &position, bool flip_x, bool flip_y) |
| Draw a sprite with the option to flip it. | |
| void | stretch_sprite (const asw::Texture &tex, const asw::Quad< float > &position) |
| Draw a sprite with the option to stretch it. | |
| void | rotate_sprite (const asw::Texture &tex, const asw::Vec2< float > &position, float angle) |
| Draw a sprite with the option to rotate it. | |
| void | stretch_sprite_rotate (const asw::Texture &tex, const asw::Quad< float > &dest, float angle, bool flip_x=false, bool flip_y=false) |
| Draw a sprite stretched to a quad, rotated around its centre and optionally flipped. | |
| void | stretch_sprite_blit (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 | stretch_sprite_rotate_blit (const asw::Texture &tex, const asw::Quad< float > &source, const asw::Quad< float > &dest, float angle, bool flip_x=false, bool flip_y=false) |
| 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, asw::TextJustify justify=asw::TextJustify::Left) |
| Draw text. The position is rounded to whole pixels after justification so glyphs stay sharp. Smooth fonts are rendered at the output resolution, so text stays sharp when the window is scaled up or on high density displays. | |
| void | text_shadow (const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color, asw::Color shadow=asw::Color(0, 0, 0), const asw::Vec2< float > &offset=asw::Vec2< float >(2.0F, 2.0F), asw::TextJustify justify=asw::TextJustify::Left) |
| Draw text with a drop shadow behind it, so it reads on any background. The shadow fades with the text colour's alpha. | |
| void | clear_text_cache () |
| Clear cached rendered text textures. | |
| 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, float thickness=1.0F) |
| Draw a rectangle. | |
| void | rect_fill (const asw::Quad< float > &position, asw::Color color) |
| Draw a filled rectangle. | |
| void | rect_fill_rotate (const asw::Quad< float > &position, float angle, asw::Color color) |
| Draw a filled rectangle rotated around its centre. | |
| void | circle (const asw::Vec2< float > &position, float radius, asw::Color color) |
| Draw a circle. | |
| void | circle_fill (const asw::Vec2< float > &position, float radius, asw::Color color) |
| Draw a filled circle. | |
| void | triangle_fill (const asw::Vec2< float > &a, const asw::Vec2< float > &b, const asw::Vec2< float > &c, asw::Color color) |
| Draw a filled triangle. | |
| void | polygon (const asw::Polygonf &points, asw::Color color) |
| Draw the outline of a polygon. The last point joins the first. | |
| void | polygon_fill (const asw::Polygonf &points, asw::Color color) |
| Draw a filled polygon. The polygon can be concave, but its edges must not cross. | |
| void | set_blend_mode (const asw::Texture &texture, asw::BlendMode mode) |
| Set the blend mode of a texture. | |
| void | set_alpha (const asw::Texture &texture, float alpha) |
| Set the alpha of a texture. | |
| void | set_tint (const asw::Texture &texture, asw::Color tint) |
| Set the tint of a texture. Each colour channel is multiplied by the tint when drawn, white draws the texture unchanged. Alpha is ignored, use set_alpha for transparency. | |
| void | set_scale_mode (const asw::Texture &texture, asw::ScaleMode mode) |
| Set the scale mode of a texture. Nearest keeps hard pixel edges, linear smooths the texture when it is scaled. | |
| void asw::draw::circle | ( | const asw::Vec2< float > & | position, |
| float | radius, | ||
| asw::Color | color ) |
| void asw::draw::circle_fill | ( | const asw::Vec2< float > & | position, |
| float | radius, | ||
| asw::Color | color ) |
| void asw::draw::clear_color | ( | asw::Color | color | ) |
| void asw::draw::clear_text_cache | ( | ) |
| void asw::draw::line | ( | const asw::Vec2< float > & | position1, |
| const asw::Vec2< float > & | position2, | ||
| asw::Color | color ) |
| void asw::draw::point | ( | const asw::Vec2< float > & | position, |
| asw::Color | color ) |
| void asw::draw::polygon | ( | const asw::Polygonf & | points, |
| asw::Color | color ) |
| void asw::draw::polygon_fill | ( | const asw::Polygonf & | points, |
| asw::Color | color ) |
| void asw::draw::rect | ( | const asw::Quad< float > & | position, |
| asw::Color | color, | ||
| float | thickness = 1.0F ) |
| void asw::draw::rect_fill | ( | const asw::Quad< float > & | position, |
| asw::Color | color ) |
| void asw::draw::rect_fill_rotate | ( | const asw::Quad< float > & | position, |
| float | angle, | ||
| asw::Color | color ) |
Draw a filled rectangle rotated around its centre.
| position | The quad defining the position and size of the rectangle before rotation. |
| angle | The angle to rotate the rectangle by in radians, clockwise like the sprite rotation functions. |
| color | The color of the rectangle. |
| void asw::draw::rotate_sprite | ( | const asw::Texture & | tex, |
| const asw::Vec2< float > & | position, | ||
| float | angle ) |
| void asw::draw::set_alpha | ( | const asw::Texture & | texture, |
| float | alpha ) |
| void asw::draw::set_blend_mode | ( | const asw::Texture & | texture, |
| asw::BlendMode | mode ) |
| void asw::draw::set_scale_mode | ( | const asw::Texture & | texture, |
| asw::ScaleMode | mode ) |
| void asw::draw::set_tint | ( | const asw::Texture & | texture, |
| asw::Color | tint ) |
| void asw::draw::sprite | ( | const asw::Texture & | tex, |
| const asw::Vec2< float > & | position ) |
| void asw::draw::sprite_flip | ( | const asw::Texture & | tex, |
| const asw::Vec2< float > & | position, | ||
| bool | flip_x, | ||
| bool | flip_y ) |
| void asw::draw::stretch_sprite | ( | const asw::Texture & | tex, |
| const asw::Quad< float > & | position ) |
| void asw::draw::stretch_sprite_blit | ( | const asw::Texture & | tex, |
| const asw::Quad< float > & | source, | ||
| const asw::Quad< float > & | dest ) |
| void asw::draw::stretch_sprite_rotate | ( | const asw::Texture & | tex, |
| const asw::Quad< float > & | dest, | ||
| float | angle, | ||
| bool | flip_x = false, | ||
| bool | flip_y = false ) |
Draw a sprite stretched to a quad, rotated around its centre and optionally flipped.
| tex | The texture to draw. |
| dest | The quad defining the position and size to stretch the sprite to. |
| angle | The angle to rotate the sprite by in radians. |
| flip_x | Whether or not to flip the sprite on the x axis. |
| flip_y | Whether or not to flip the sprite on the y axis. |
| void asw::draw::stretch_sprite_rotate_blit | ( | const asw::Texture & | tex, |
| const asw::Quad< float > & | source, | ||
| const asw::Quad< float > & | dest, | ||
| float | angle, | ||
| bool | flip_x = false, | ||
| bool | flip_y = false ) |
Draw a sprite with the option to stretch and rotate a portion of it.
| tex | The texture to draw. |
| source | The quad defining the portion of the texture to stretch. |
| dest | The quad defining the position and size to stretch the sprite to. |
| angle | The angle to rotate the sprite by in radians. |
| flip_x | Whether or not to flip the sprite on the x axis. |
| flip_y | Whether or not to flip the sprite on the y axis. |
| void asw::draw::text | ( | const asw::Font & | font, |
| const std::string & | text, | ||
| const asw::Vec2< float > & | position, | ||
| asw::Color | color, | ||
| asw::TextJustify | justify = asw::TextJustify::Left ) |
Draw text. The position is rounded to whole pixels after justification so glyphs stay sharp. Smooth fonts are rendered at the output resolution, so text stays sharp when the window is scaled up or on high density displays.
| font | The font to use. |
| text | The text to draw. |
| position | The position to draw the text at. |
| color | The color to draw the text. |
| justify | The justification of the text. |
| void asw::draw::text_shadow | ( | const asw::Font & | font, |
| const std::string & | text, | ||
| const asw::Vec2< float > & | position, | ||
| asw::Color | color, | ||
| asw::Color | shadow = asw::Color(0, 0, 0), | ||
| const asw::Vec2< float > & | offset = asw::Vec2<float>(2.0F, 2.0F), | ||
| asw::TextJustify | justify = asw::TextJustify::Left ) |
Draw text with a drop shadow behind it, so it reads on any background. The shadow fades with the text colour's alpha.
| font | The font to use. |
| text | The text to draw. |
| position | The position to draw the text at. |
| color | The color of the text. |
| shadow | The color of the shadow. |
| offset | How far the shadow sits from the text. |
| justify | The justification of the text. |
| void asw::draw::triangle_fill | ( | const asw::Vec2< float > & | a, |
| const asw::Vec2< float > & | b, | ||
| const asw::Vec2< float > & | c, | ||
| asw::Color | color ) |