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
22void clear_color(asw::Color color);
23
29void sprite(const asw::Texture& tex, const asw::Vec2<float>& position);
30
38void sprite_flip(
39 const asw::Texture& tex, const asw::Vec2<float>& position, bool flip_x, bool flip_y);
40
47void stretch_sprite(const asw::Texture& tex, const asw::Quad<float>& position);
48
55void rotate_sprite(const asw::Texture& tex, const asw::Vec2<float>& position, float angle);
56
65 const asw::Texture& tex, const asw::Quad<float>& source, const asw::Quad<float>& dest);
66
76void stretch_sprite_rotate_blit(const asw::Texture& tex, const asw::Quad<float>& source,
77 const asw::Quad<float>& dest, float angle);
78
87void text(const asw::Font& font, const std::string& text, const asw::Vec2<float>& position,
89
95void point(const asw::Vec2<float>& position, asw::Color color);
96
103void line(const asw::Vec2<float>& position1, const asw::Vec2<float>& position2, asw::Color color);
104
110void rect(const asw::Quad<float>& position, asw::Color color);
111
117void rect_fill(const asw::Quad<float>& position, asw::Color color);
118
125void circle(const asw::Vec2<float>& position, float radius, asw::Color color);
126
133void circle_fill(const asw::Vec2<float>& position, float radius, asw::Color color);
134
140void set_blend_mode(const asw::Texture& texture, asw::BlendMode mode);
141
147void set_alpha(const asw::Texture& texture, float alpha);
148} // namespace asw::draw
149
150#endif // ASW_DRAW_H
A 2D rectangle in space.
Definition geometry.h:433
A 2D vector in space.
Definition geometry.h:21
Common geometry types.
void sprite(const asw::Texture &tex, const asw::Vec2< float > &position)
Draw a sprite.
Definition draw.cpp:23
void circle_fill(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a filled circle.
Definition draw.cpp:281
void clear_color(asw::Color color)
Clear the screen to a color.
Definition draw.cpp:12
void line(const asw::Vec2< float > &position1, const asw::Vec2< float > &position2, asw::Color color)
Draw a line.
Definition draw.cpp:200
void rotate_sprite(const asw::Texture &tex, const asw::Vec2< float > &position, float angle)
Draw a sprite with the option to rotate it.
Definition draw.cpp:86
void stretch_sprite(const asw::Texture &tex, const asw::Quad< float > &position)
Draw a sprite with the option to stretch it.
Definition draw.cpp:70
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.
Definition draw.cpp:156
void stretch_sprite_rotate_blit(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:131
void rect(const asw::Quad< float > &position, asw::Color color)
Draw a rectangle.
Definition draw.cpp:212
void circle(const asw::Vec2< float > &position, float radius, asw::Color color)
Draw a circle.
Definition draw.cpp:246
void rect_fill(const asw::Quad< float > &position, asw::Color color)
Draw a filled rectangle.
Definition draw.cpp:229
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.
Definition draw.cpp:41
void point(const asw::Vec2< float > &position, asw::Color color)
Draw a point.
Definition draw.cpp:189
void set_blend_mode(const asw::Texture &texture, asw::BlendMode mode)
Set the blend mode of a texture.
Definition draw.cpp:312
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.
Definition draw.cpp:108
void set_alpha(const asw::Texture &texture, float alpha)
Set the alpha of a texture.
Definition draw.cpp:317
std::shared_ptr< TTF_Font > Font
Alias for a shared pointer to an TTF_Font.
Definition types.h:41
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
Definition types.h:38
BlendMode
Mappings from SDL_BLENDMODE to ASW BlendMode.
Definition types.h:20
TextJustify
Text justification options for text rendering.
Definition types.h:31
RGBA color struct with 8-bit channels.
Definition color.h:11
Types used throughout the ASW library.