![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
A sprite is a texture with vertex data. More...
#include <Sprite.hpp>
Public Member Functions | |
Sprite () | |
Constructor. | |
Sprite (const nlohmann::json &json) | |
JSON constructor. | |
Sprite (Sprite &&) | |
Move constructor. | |
Sprite & | operator= (Sprite &&) |
Move assignment operator. | |
virtual | ~Sprite () |
Destructor. | |
void | set_texture (const std::string &texture) |
Sets the texture and vertex data. | |
void | set_texture (const std::string &texture, const math::fRect &rect) |
Sets the texture and vertex data. | |
void | set_clip (const math::fRect &rect) |
Set texture clip. | |
const math::fRect & | get_clip () const |
Get texture clip. | |
graphics::Texture2D * | get_texture () |
Get texture. | |
const std::string & | get_texture_name () const |
Texture name. | |
nlohmann::json | serialize () override |
Serializes object. | |
void | deserialize (const nlohmann::json &json) override |
Deserializes from object. | |
![]() | |
virtual | ~Serializable () |
Destructor. | |
virtual Serializable & | operator= (Serializable &&)=default |
Move assignment operator. | |
virtual Serializable & | operator= (const Serializable &)=default |
Copy assignment operator. | |
Public Attributes | |
graphics::VertexArray | m_vao |
Vertex Array Object. | |
graphics::Colour | m_tint |
Texture tint. | |
Private Member Functions | |
Sprite (const Sprite &)=delete | |
Copy constructor. | |
Sprite & | operator= (const Sprite &)=delete |
Copy assignment operator. | |
Private Attributes | |
graphics::Texture2D * | m_texture |
Texture. | |
std::string | m_name |
Texture debug name. | |
std::array< graphics::Vertex, 4 > | m_vertices |
Vertex data. | |
math::fRect | m_clip |
Texture clip. | |
Additional Inherited Members | |
![]() | |
Serializable () | |
Constructor. | |
A sprite is a texture with vertex data.
Definition at line 24 of file Sprite.hpp.
galaxy::components::Sprite::Sprite | ( | ) |
Constructor.
Definition at line 19 of file Sprite.cpp.
galaxy::components::Sprite::Sprite | ( | const nlohmann::json & | json | ) |
JSON constructor.
json | JSON defining object. |
Definition at line 26 of file Sprite.cpp.
galaxy::components::Sprite::Sprite | ( | Sprite && | s | ) |
Move constructor.
Definition at line 32 of file Sprite.cpp.
|
virtual |
Destructor.
Definition at line 74 of file Sprite.cpp.
|
privatedelete |
Copy constructor.
Move assignment operator.
Definition at line 51 of file Sprite.cpp.
void galaxy::components::Sprite::set_texture | ( | const std::string & | texture | ) |
Sets the texture and vertex data.
texture | Texture file in VFS. |
Definition at line 82 of file Sprite.cpp.
void galaxy::components::Sprite::set_texture | ( | const std::string & | texture, |
const math::fRect & | rect ) |
Sets the texture and vertex data.
texture | Texture file in VFS. |
rect | Custom region on a texture to render from. |
Definition at line 112 of file Sprite.cpp.
void galaxy::components::Sprite::set_clip | ( | const math::fRect & | rect | ) |
Set texture clip.
rect | Coords on sprite to clip to. |
Definition at line 161 of file Sprite.cpp.
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscardoverridevirtual |
Serializes object.
Implements galaxy::fs::Serializable.
Definition at line 208 of file Sprite.cpp.
|
overridevirtual |
Deserializes from object.
json | Json object to retrieve data from. |
Implements galaxy::fs::Serializable.
Definition at line 220 of file Sprite.cpp.
Copy assignment operator.
graphics::VertexArray galaxy::components::Sprite::m_vao |
Vertex Array Object.
Definition at line 130 of file Sprite.hpp.
graphics::Colour galaxy::components::Sprite::m_tint |
Texture tint.
Definition at line 135 of file Sprite.hpp.
|
private |
Texture.
Definition at line 141 of file Sprite.hpp.
|
private |
Texture debug name.
Definition at line 146 of file Sprite.hpp.
|
private |
Vertex data.
Definition at line 151 of file Sprite.hpp.
|
private |
Texture clip.
Definition at line 156 of file Sprite.hpp.