diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-08 13:14:37 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-08 13:14:37 +0100 |
commit | 8ea70b897805ff84113758d45a4c5c1a171a77bd (patch) | |
tree | ae16972b2c98a41336372816505d55deaa381acf /src/crepe/api/Sprite.cpp | |
parent | 4d5a1570908d47b8f2d3bfa65634f2fb2dcf7e3c (diff) |
implement sprite replay
Diffstat (limited to 'src/crepe/api/Sprite.cpp')
-rw-r--r-- | src/crepe/api/Sprite.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/crepe/api/Sprite.cpp b/src/crepe/api/Sprite.cpp index 0107c7b..2919857 100644 --- a/src/crepe/api/Sprite.cpp +++ b/src/crepe/api/Sprite.cpp @@ -19,3 +19,18 @@ Sprite::Sprite(game_object_id_t id, const Asset & texture, const Sprite::Data & } Sprite::~Sprite() { dbg_trace(); } + +unique_ptr<Component> Sprite::save() const { + return unique_ptr<Component>(new Sprite(*this)); +} + +void Sprite::restore(const Component & snapshot) { + *this = static_cast<const Sprite &>(snapshot); +} + +Sprite & Sprite::operator=(const Sprite & snapshot) { + this->active = snapshot.active; + this->data = snapshot.data; + this->mask = snapshot.mask; + return *this; +} |