Wrapper class to encapsulate creation and management of an SDL_Texture. More...
#include <texture.hpp>
Classes | |
struct | info |
Small wrapper that queries metadata about the provided texture. More... | |
Public Member Functions | |
texture () | |
Default ctor. More... | |
texture (const texture &)=default | |
texture (SDL_Texture *txt) | |
Assigns the given texture to this one. More... | |
texture (const surface &surf) | |
Construct a texture from a surface. More... | |
texture (int w, int h, SDL_TextureAccess access) | |
Construct a texture of the specified size and access type. More... | |
const info | get_info () const |
Queries metadata about the texture, such as its dimensions. More... | |
void | reset () |
Releases ownership of the managed texture and resets the ptr to null. More... | |
void | reset (int w, int h, SDL_TextureAccess access) |
Releases ownership of the managed texture and creates a new one. More... | |
void | assign (SDL_Texture *t) |
Replaces ownership of the managed texture with the given one. More... | |
texture & | operator= (const texture &t)=default |
texture & | operator= (texture &&t) |
Move assignment. More... | |
operator SDL_Texture * () const | |
bool | null () const |
Private Member Functions | |
void | finalize () |
Private Attributes | |
std::shared_ptr< SDL_Texture > | texture_ |
Wrapper class to encapsulate creation and management of an SDL_Texture.
Supports free creation and creation from a surface.
Definition at line 27 of file texture.hpp.
texture::texture | ( | ) |
|
default |
|
explicit |
Assigns the given texture to this one.
Definition at line 45 of file texture.cpp.
References finalize().
|
explicit |
Construct a texture from a surface.
Definition at line 51 of file texture.cpp.
References ERR_SDL, CVideo::get_renderer(), CVideo::get_singleton(), and texture_.
texture::texture | ( | int | w, |
int | h, | ||
SDL_TextureAccess | access | ||
) |
Construct a texture of the specified size and access type.
Definition at line 65 of file texture.cpp.
References reset().
void texture::assign | ( | SDL_Texture * | t | ) |
Replaces ownership of the managed texture with the given one.
Definition at line 101 of file texture.cpp.
References texture_.
Referenced by get_info().
|
private |
Definition at line 71 of file texture.cpp.
References set_texture_blend_mode().
|
inline |
Queries metadata about the texture, such as its dimensions.
Definition at line 56 of file texture.hpp.
References assign(), texture::info::info(), operator=(), reset(), and t.
Referenced by render_target_setter::render_target_setter().
|
inline |
Definition at line 80 of file texture.hpp.
References finalize(), and texture_.
|
inline |
Definition at line 75 of file texture.hpp.
References texture_.
Referenced by get_info().
Move assignment.
Releases ownership of the managed texture from the passed object.
Definition at line 106 of file texture.cpp.
void texture::reset | ( | ) |
Releases ownership of the managed texture and resets the ptr to null.
Definition at line 76 of file texture.cpp.
References texture_.
Referenced by get_info(), reset(), and texture().
void texture::reset | ( | int | w, |
int | h, | ||
SDL_TextureAccess | access | ||
) |
Releases ownership of the managed texture and creates a new one.
Definition at line 83 of file texture.cpp.
References ERR_SDL, finalize(), CVideo::get_renderer(), CVideo::get_singleton(), reset(), and texture_.
|
private |
Definition at line 88 of file texture.hpp.
Referenced by assign(), null(), operator SDL_Texture *(), operator=(), reset(), and texture().