aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Sprite.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-08 15:33:41 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-08 15:33:41 +0100
commitce83df284173cfb4f6e430bf3ed8080ea21204d7 (patch)
treecb30e6bd44b4cf61ee696b55b46f7b817bf4157a /src/crepe/api/Sprite.cpp
parent698628cf1fb1b8a1f68bf6a5672d984bd64be58f (diff)
parent26fe39ef4e633206a9b202d431c969c66052d2ef (diff)
Merge branch 'master' into niels/game
Diffstat (limited to 'src/crepe/api/Sprite.cpp')
-rw-r--r--src/crepe/api/Sprite.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crepe/api/Sprite.cpp b/src/crepe/api/Sprite.cpp
index 0107c7b..3c77e2e 100644
--- a/src/crepe/api/Sprite.cpp
+++ b/src/crepe/api/Sprite.cpp
@@ -19,3 +19,16 @@ 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;
+}