29#ifndef NOMLIB_GRAPHICS_SPRITE_HPP
30#define NOMLIB_GRAPHICS_SPRITE_HPP
35#include "nomlib/config.hpp"
36#include "nomlib/math/Transformable.hpp"
37#include "nomlib/math/Rect.hpp"
38#include "nomlib/math/Point2.hpp"
39#include "nomlib/system/SDL_helpers.hpp"
49class NOM_EXPORT Sprite:
public Transformable
52 typedef Sprite self_type;
53 typedef Transformable derived_class;
81 virtual void set_size(
const Size2i& dims)
override;
84 std::unique_ptr<Sprite>
clone()
const;
86 std::shared_ptr<Texture> texture()
const;
131 bool set_alpha(uint8 opacity);
133 bool set_color(
const Color4i&
color);
135 bool set_color_blend_mode(BlendMode blend);
174NOM_EXPORT std::unique_ptr<Sprite>
175make_unique_sprite(
Texture& tex);
180NOM_EXPORT std::unique_ptr<Sprite>
181make_unique_sprite(
Texture* tex);
186NOM_EXPORT std::unique_ptr<Sprite>
187make_unique_sprite(std::shared_ptr<Texture>& tex);
192NOM_EXPORT std::shared_ptr<Sprite>
193make_shared_sprite(
Texture& tex);
198NOM_EXPORT std::shared_ptr<Sprite>
199make_shared_sprite(
Texture* tex);
204NOM_EXPORT std::shared_ptr<Sprite>
205make_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.