8#ifndef GALAXY_COMPONENTS_SPRITE_HPP_
9#define GALAXY_COMPONENTS_SPRITE_HPP_
12#include "galaxy/graphics/Colour.hpp"
13#include "galaxy/graphics/gl/Texture2D.hpp"
14#include "galaxy/graphics/gl/VertexArray.hpp"
15#include "galaxy/math/Rect.hpp"
37 Sprite(
const nlohmann::json& json);
67 void set_texture(
const std::string& texture,
const math::fRect& rect);
74 void set_clip(
const math::fRect& rect);
113 void deserialize(
const nlohmann::json& json)
override;
A sprite is a texture with vertex data.
const math::fRect & get_clip() const
Get texture clip.
Sprite & operator=(const Sprite &)=delete
Copy assignment operator.
math::fRect m_clip
Texture clip.
void deserialize(const nlohmann::json &json) override
Deserializes from object.
graphics::Colour m_tint
Texture tint.
const std::string & get_texture_name() const
Texture name.
void set_clip(const math::fRect &rect)
Set texture clip.
Sprite(const Sprite &)=delete
Copy constructor.
graphics::Texture2D * get_texture()
Get texture.
graphics::VertexArray m_vao
Vertex Array Object.
Sprite & operator=(Sprite &&)
Move assignment operator.
nlohmann::json serialize() override
Serializes object.
std::array< graphics::Vertex, 4 > m_vertices
Vertex data.
std::string m_name
Texture debug name.
virtual ~Sprite()
Destructor.
void set_texture(const std::string &texture)
Sets the texture and vertex data.
graphics::Texture2D * m_texture
Texture.
Allows a class to be serialized.