HoverRace  2.0
Public Member Functions | Protected Attributes | Private Types | List of all members
HoverRace::Display::SDL::SdlDynamicTexture Class Reference

Wrapper for an SDL texture that can be updated. More...

#include <SdlDynamicTexture.h>

+ Inheritance diagram for HoverRace::Display::SDL::SdlDynamicTexture:

Public Member Functions

 SdlDynamicTexture ()=delete
 
 SdlDynamicTexture (SdlDisplay &display, SDL_Texture *texture)
 Constructor. More...
 
 SdlDynamicTexture (SdlDisplay &display, int width, int height)
 Constructor, with a new texture. More...
 
 SdlDynamicTexture (const SdlDynamicTexture &)=delete
 
virtual ~SdlDynamicTexture ()
 
bool IsDirty () const
 Check if this texture has changes that haven't been updated yet. More...
 
SdlDynamicTextureoperator= (const SdlDynamicTexture &)=delete
 
bool Update ()
 Updates the texture from the backing surface. More...
 
template<class Fn >
void Update (Fn fn)
 Updates the texture with new pixel data. More...
 
- Public Member Functions inherited from HoverRace::Display::SDL::SdlTexture
 SdlTexture ()=delete
 
 SdlTexture (SdlDisplay &display, SDL_Texture *texture)
 
 SdlTexture (const SdlTexture &)=delete
 
virtual ~SdlTexture ()
 
SDL_Texture * Get () const
 
SdlTextureoperator= (const SdlTexture &)=delete
 
- Public Member Functions inherited from HoverRace::Display::Texture
 Texture ()
 
virtual ~Texture ()
 

Protected Attributes

bool dirty
 
SDL_Surface * surface
 
- Protected Attributes inherited from HoverRace::Display::SDL::SdlTexture
SdlDisplaydisplay
 
SDL_Texture * texture
 

Private Types

using SUPER = SdlTexture
 

Detailed Description

Wrapper for an SDL texture that can be updated.

Author
Michael Imamura

Member Typedef Documentation

Constructor & Destructor Documentation

HoverRace::Display::SDL::SdlDynamicTexture::SdlDynamicTexture ( )
delete
HoverRace::Display::SDL::SdlDynamicTexture::SdlDynamicTexture ( SdlDisplay display,
SDL_Texture *  texture 
)

Constructor.

Parameters
displayThe display.
textureThe texture (may not be nullptr).
Exceptions
DynamicTextureExnCould not be created (texture will still be freed).
HoverRace::Display::SDL::SdlDynamicTexture::SdlDynamicTexture ( SdlDisplay display,
int  width,
int  height 
)

Constructor, with a new texture.

Parameters
displayThe display.
widthThe requested width.
heightThe requested height.
Exceptions
DynamicTextureExnCould not be created.
HoverRace::Display::SDL::SdlDynamicTexture::SdlDynamicTexture ( const SdlDynamicTexture )
delete
virtual HoverRace::Display::SDL::SdlDynamicTexture::~SdlDynamicTexture ( )
inlinevirtual

Member Function Documentation

bool HoverRace::Display::SDL::SdlDynamicTexture::IsDirty ( ) const
inline

Check if this texture has changes that haven't been updated yet.

Call Update() to write the commit the changes to the texture.

Returns
true if dirty, false if not.
SdlDynamicTexture& HoverRace::Display::SDL::SdlDynamicTexture::operator= ( const SdlDynamicTexture )
delete
bool HoverRace::Display::SDL::SdlDynamicTexture::Update ( )
inline

Updates the texture from the backing surface.

Returns
true if an update was performed (dirty flag was set), false if no update was needed.
template<class Fn >
void HoverRace::Display::SDL::SdlDynamicTexture::Update ( Fn  fn)
inline

Updates the texture with new pixel data.

Parameters
fnThe update function. Will be passed the drawing surface. Returns true to update the texture immediately, or false to defer the update until a later call to Update().

Member Data Documentation

bool HoverRace::Display::SDL::SdlDynamicTexture::dirty
protected
SDL_Surface* HoverRace::Display::SDL::SdlDynamicTexture::surface
protected

The documentation for this class was generated from the following files: