29 #include "nomlib/graphics/sprite/Sprite.hpp"
35 NOM_LOG_TRACE ( NOM );
43 NOM_LOG_TRACE ( NOM );
49 this->coords = other.coords;
58 NOM_LOG_TRACE ( NOM );
61 const Point2i Sprite::size (
void )
const
66 const Point2i Sprite::position (
void )
const
68 return Point2i ( this->coords.x, this->coords.y );
82 const std::string& filename,
const Color& colorkey,
90 NOM_LOG_ERR ( NOM,
"Could not load sprite image file: " + filename );
125 NOM_LOG_ERR ( NOM,
"Video surface is invalid." );
129 if ( this->
sprite.
resize ( scaling_algorithm ) == false )
131 NOM_LOG_ERR ( NOM,
"Failed to resize the video surface." );
145 NOM_LOG_ERR ( NOM,
"Video surface is invalid." );
151 NOM_LOG_ERR ( NOM,
"Failed to resize the video surface." );
void set_position(const Point2i &pos)
int32 scale_factor
Scale factor applied if the resize method is called.
bool set_colorkey(const Color &colorkey)
static const Color null
Convenience object that will always contain a value of -1.
void draw(SDL_RENDERER::RawPtr target) const
virtual void update(void)
bool load(const std::string &filename, uint32 flags, bool use_cache=false)
virtual ~Sprite(void)
Destructor.
bool resize(enum ResizeAlgorithm scaling_algorithm)
Rescale the font with a chosen resizing algorithm.
Texture sprite
Object that holds our sprite image.
bool load(const std::string &filename, const Color &colorkey, bool use_cache=false)
Load a new image onto the Sprite.
void draw(RenderTarget target) const
Render the object onto the primary video buffer – your visible screen.
uint32 state
Convenience instance variable (user-defined)
Sprite & operator=(const Sprite &other)
Copy assignment operator.
uint32 getState(void) const
Get the object's state.
SDL_RENDERER::RawPtr renderer(void) const
Get a raw pointer to the SDL_Renderer in use.
int32 getResizeScaleFactor(enum ResizeAlgorithm scaling_algorithm)
bool valid(void) const
Is this object initialized – not nullptr?
Coordinate values (x, y, z, width, height ) wrapper.
void setState(uint32 state)
Set a new state.
Utility class container for RGBA colors.
bool resize(enum ResizeAlgorithm scaling_algorithm)
Base class for bitmap objects.