29#ifndef NOMLIB_GRAPHICS_SPRITE_HPP
30#define NOMLIB_GRAPHICS_SPRITE_HPP
34#include "nomlib/config.hpp"
35#include "nomlib/math/Transformable.hpp"
36#include "nomlib/math/Rect.hpp"
37#include "nomlib/math/Point2.hpp"
38#include "nomlib/system/SDL_helpers.hpp"
48class Sprite:
public Transformable
51 typedef Sprite self_type;
52 typedef Transformable derived_class;
80 virtual void set_size(
const Size2i& dims)
override;
83 std::unique_ptr<Sprite>
clone()
const;
85 std::shared_ptr<Texture> texture()
const;
130 bool set_alpha(uint8 opacity);
132 bool set_color(
const Color4i&
color);
134 bool set_color_blend_mode(BlendMode blend);
173std::unique_ptr<Sprite>
174make_unique_sprite(
Texture& tex);
179std::unique_ptr<Sprite>
180make_unique_sprite(
Texture* tex);
185std::unique_ptr<Sprite>
186make_unique_sprite(std::shared_ptr<Texture>& tex);
191std::shared_ptr<Sprite>
192make_shared_sprite(
Texture& tex);
197std::shared_ptr<Sprite>
198make_shared_sprite(
Texture* tex);
203std::shared_ptr<Sprite>
204make_shared_sprite(std::shared_ptr<Texture>& tex);
const RenderWindow RenderTarget
Run-time type information (RTTI) container class.
std::shared_ptr< Texture > texture_
The underlying texture for the sprite.
void release_texture()
Free the stored texture.
virtual void update() override
std::unique_ptr< Sprite > clone() const
Implements the required IDrawable::clone method.
bool set_texture(Texture &tex)
Construct a sprite from an existing texture source.
Color4i color() const
Get the texture color of the sprite.
ObjectTypeInfo type() const override
Re-implements the IObject::type method.
virtual void set_position(const Point2i &pos) override
Re-implements Transformable::set_position.
virtual void set_size(const Size2i &dims) override
Re-implements Transformable::set_size.
bool set_texture(std::shared_ptr< Texture > &tex)
Construct a sprite from an existing texture source.
virtual void draw(RenderTarget &target, real64 angle) const
bool set_texture(Texture *tex)
Construct a sprite from an existing texture source.
virtual void draw(RenderTarget &target) const override
Render the object onto the primary video buffer – your visible screen.
BlendMode color_blend_mode() const
Get the color blend mode of the sprite.
bool init_with_color(const Color4i &color, const Size2i &dims)
Construct a sprite from a dimension and color.
uint8 alpha() const
Get the alpha value of the sprite.