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 "./color.h"
13#include "./geometry.h"
14#include "./types.h"
15
16namespace asw::draw {
17
22 void clearColor(asw::Color color);
23
29 void sprite(const asw::Texture& tex, const asw::Vec2<float>& position);
30
38 void spriteFlip(const asw::Texture& tex,
39 const asw::Vec2<float>& position,
40 bool flipX,
41 bool flipY);
42
49 void stretchSprite(const asw::Texture& tex, const asw::Quad<float>& position);
50
57 void rotateSprite(const asw::Texture& tex,
58 const asw::Vec2<float>& position,
59 float angle);
60
68 void stretchSpriteBlit(const asw::Texture& tex,
69 const asw::Quad<float>& source,
70 const asw::Quad<float>& dest);
71
82 const asw::Quad<float>& source,
83 const asw::Quad<float>& dest,
84 float angle);
85
93 void text(const asw::Font& font,
94 const std::string& text,
95 const asw::Vec2<float>& position,
96 asw::Color color);
97
105 void textCenter(const asw::Font& font,
106 const std::string& text,
107 const asw::Vec2<float>& position,
108 asw::Color color);
109
117 void textRight(const asw::Font& font,
118 const std::string& text,
119 const asw::Vec2<float>& position,
120 asw::Color color);
121
127 void point(const asw::Vec2<float>& position, asw::Color color);
128
135 void line(const asw::Vec2<float>& position1,
136 const asw::Vec2<float>& position2,
137 asw::Color color);
138
144 void rect(const asw::Quad<float>& position, asw::Color color);
145
151 void rectFill(const asw::Quad<float>& position, asw::Color color);
152
159 void circle(const asw::Vec2<float>& position, float radius, asw::Color color);
160
167 void circleFill(const asw::Vec2<float>& position,
168 float radius,
169 asw::Color color);
170
176 void setBlendMode(const asw::Texture& texture, asw::BlendMode mode);
177
183 void setAlpha(const asw::Texture& texture, float alpha);
184} // namespace asw::draw
185
186#endif // ASW_DRAW_H
A 2D rectangle in space.
Definition geometry.h:370
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:329
void stretchSpriteRotateBlit(const asw::Texture &tex, const asw::Quad< float > &source, const asw::Quad< float > &dest, float angle)
Draw a sprite with the option to stretch and rotate a portion of it.
Definition draw.cpp:127
void sprite(const asw::Texture &tex, const asw::Vec2< float > &position)
Draw a sprite.
Definition draw.cpp:21
void stretchSprite(const asw::Texture &tex, const asw::Quad< float > &position)
Draw a sprite with the option to stretch it.
Definition draw.cpp:68
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:181
void line(const asw::Vec2< float > &position1, const asw::Vec2< float > &position2, asw::Color color)
Draw a line.
Definition draw.cpp:216
void rotateSprite(const asw::Texture &tex, const asw::Vec2< float > &position, float angle)
Draw a sprite with the option to rotate it.
Definition draw.cpp:83
void rectFill(const asw::Quad< float > &position, asw::Color color)
Draw a filled rectangle.
Definition draw.cpp:245
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:105
void setAlpha(const asw::Texture &texture, float alpha)
Set the alpha of a texture.
Definition draw.cpp:333
void rect(const asw::Quad< float > &position, asw::Color color)
Draw a rectangle.
Definition draw.cpp:229
void circle(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a circle.
Definition draw.cpp:261
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:38
void circleFill(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a filled circle.
Definition draw.cpp:297
void point(const asw::Vec2< float > &position, asw::Color color)
Draw a point.
Definition draw.cpp:206
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:194
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:153
std::shared_ptr< TTF_Font > Font
Alias for a shared pointer to an TTF_Font.
Definition types.h:34
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
Definition types.h:31
BlendMode
Mappings from SDL_BLENDMODE to ASW BlendMode.
Definition types.h:20
RGBA color struct with 8-bit channels.
Definition color.h:11
Types used throughout the ASW library.