aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Sprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/Sprite.cpp')
-rw-r--r--src/crepe/api/Sprite.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/crepe/api/Sprite.cpp b/src/crepe/api/Sprite.cpp
index ba684ba..3c77e2e 100644
--- a/src/crepe/api/Sprite.cpp
+++ b/src/crepe/api/Sprite.cpp
@@ -1,6 +1,6 @@
#include <cmath>
-#include "../util/Log.h"
+#include "../util/dbg.h"
#include "api/Asset.h"
#include "Component.h"
@@ -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;
+}