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
draw.h
Go to the documentation of this file.
1
8
9#ifndef ASW_DRAW_H
10#define ASW_DRAW_H
11
12#include "./geometry.h"
13#include "./types.h"
14
15namespace asw::draw {
16
21 void clearColor(asw::Color color);
22
28 void sprite(const asw::Texture& tex, const asw::Vec2<float>& position);
29
37 void spriteFlip(const asw::Texture& tex,
38 const asw::Vec2<float>& position,
39 bool flipX,
40 bool flipY);
41
48 void stretchSprite(const asw::Texture& tex, const asw::Quad<float>& position);
49
56 void rotateSprite(const asw::Texture& tex,
57 const asw::Vec2<float>& position,
58 double angle);
59
67 void stretchSpriteBlit(const asw::Texture& tex,
68 const asw::Quad<float>& source,
69 const asw::Quad<float>& dest);
70
81 const asw::Quad<float>& source,
82 const asw::Quad<float>& dest,
83 double angle);
84
92 void text(const asw::Font& font,
93 const std::string& text,
94 const asw::Vec2<float>& position,
95 asw::Color color);
96
104 void textCenter(const asw::Font& font,
105 const std::string& text,
106 const asw::Vec2<float>& position,
107 asw::Color color);
108
116 void textRight(const asw::Font& font,
117 const std::string& text,
118 const asw::Vec2<float>& position,
119 asw::Color color);
120
126 void point(const asw::Vec2<float>& position, asw::Color color);
127
134 void line(const asw::Vec2<float>& position1,
135 const asw::Vec2<float>& position2,
136 asw::Color color);
137
143 void rect(const asw::Quad<float>& position, asw::Color color);
144
150 void rectFill(const asw::Quad<float>& position, asw::Color color);
151
158 void circle(const asw::Vec2<float>& position, float radius, asw::Color color);
159
166 void circleFill(const asw::Vec2<float>& position,
167 float radius,
168 asw::Color color);
169
175 void setBlendMode(const asw::Texture& texture, asw::BlendMode mode);
176
182 void setAlpha(const asw::Texture& texture, float alpha);
183} // namespace asw::draw
184
185#endif // ASW_DRAW_H
A 2D rectangle in space.
Definition geometry.h:193
A 2D vector in space.
Definition geometry.h:22
Common geometry types.
void setBlendMode(const asw::Texture &texture, asw::BlendMode mode)
Set the blend mode of a texture.
Definition draw.cpp:226
void sprite(const asw::Texture &tex, const asw::Vec2< float > &position)
Draw a sprite.
Definition draw.cpp:17
void stretchSprite(const asw::Texture &tex, const asw::Quad< float > &position)
Draw a sprite with the option to stretch it.
Definition draw.cpp:56
void rotateSprite(const asw::Texture &tex, const asw::Vec2< float > &position, double angle)
Draw a sprite with the option to rotate it.
Definition draw.cpp:67
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.
Definition draw.cpp:100
void textCenter(const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
Draw text center aligned.
Definition draw.cpp:146
void line(const asw::Vec2< float > &position1, const asw::Vec2< float > &position2, asw::Color color)
Draw a line.
Definition draw.cpp:169
void rectFill(const asw::Quad< float > &position, asw::Color color)
Draw a filled rectangle.
Definition draw.cpp:190
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.
Definition draw.cpp:82
void setAlpha(const asw::Texture &texture, float alpha)
Set the alpha of a texture.
Definition draw.cpp:230
void rect(const asw::Quad< float > &position, asw::Color color)
Draw a rectangle.
Definition draw.cpp:178
void circle(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a circle.
Definition draw.cpp:202
void spriteFlip(const asw::Texture &tex, const asw::Vec2< float > &position, bool flipX, bool flipY)
Draw a sprite with the option to flip it.
Definition draw.cpp:30
void circleFill(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a filled circle.
Definition draw.cpp:214
void point(const asw::Vec2< float > &position, asw::Color color)
Draw a point.
Definition draw.cpp:163
void textRight(const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
Draw text right aligned.
Definition draw.cpp:155
void clearColor(asw::Color color)
Clear the screen to a color.
Definition draw.cpp:11
void text(const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
Draw text left aligned.
Definition draw.cpp:120
std::shared_ptr< TTF_Font > Font
Alias for a shared pointer to an TTF_Font.
Definition types.h:23
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
Definition types.h:20
BlendMode
Mappings from SDL_BLENDMODE to ASW BlendMode.
Definition types.h:41
SDL_Color Color
Alias for an SDL_Color.
Definition types.h:38
Types used throughout the ASW library.