20 #include <SDL2/SDL_hints.h>
21 #include <SDL2/SDL_render.h>
44 explicit texture(SDL_Texture* txt);
59 texture(
int w,
int h, SDL_TextureAccess access);
69 explicit info(SDL_Texture*
t);
105 int w()
const {
return w_; }
114 int h()
const {
return h_; }
191 void reset(
int width,
int height, SDL_TextureAccess access);
201 operator SDL_Texture*()
const
206 explicit operator bool()
const
229 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, value);
Wrapper class to encapsulate creation and management of an SDL_Texture.
uint8_t get_alpha_mod() const
int w() const
The draw-space width of the texture, in pixels.
rect src_
uninitialized by default.
SDL_BlendMode get_blend_mode() const
int get_access() const
The texture access mode.
uint32_t get_format() const
The internal texture format.
void set_draw_width(int w)
Set the intended width of the texture, in draw-space.
std::shared_ptr< SDL_Texture > texture_
void set_blend_mode(SDL_BlendMode)
Blend mode.
bool has_src_
true iff the source rect is valid
bool operator==(const texture &t) const
Texture comparisons explicitly only care about the pointer value.
void reset()
Releases ownership of the managed texture and resets the ptr to null.
void set_src(const rect &r)
Set the source region of the texture used for drawing operations.
texture()=default
Default ctor.
void set_draw_height(int h)
Set the intended height of the texture, in draw-space.
point draw_size() const
The size of the texture in draw-space.
void set_draw_size(int w, int h)
Set the intended size of the texture, in draw-space.
point get_raw_size() const
The raw internal texture size.
const rect * src() const
A pointer to a rect indicating the source region of the underlying SDL_Texture to be used when drawin...
int h() const
The draw-space height of the texture, in pixels.
void assign(SDL_Texture *t)
Replaces ownership of the managed texture with the given one.
void set_alpha_mod(uint8_t alpha)
Alpha modifier.
color_t get_color_mod() const
void clear_src()
Clear the source region.
void set_src_raw(const rect &r)
Set the source region of the texture used for drawing operations.
SDL_Texture * get() const
const info get_info() const
Queries metadata about the texture, such as its dimensions.
void set_color_mod(uint8_t r, uint8_t g, uint8_t b)
Colour modifier.
Contains the SDL_Rect helper code.
The basic class for representing 8-bit RGB or RGBA colour values.
An abstract description of a rectangle with integer coordinates.
Small wrapper that queries metadata about the provided texture.
void set_texture_scale_quality(const char *value)
Sets the texture scale quality.