From ea5e62b4ca8fbe214605abdab486bf6dcc1cc540 Mon Sep 17 00:00:00 2001
From: heavydemon21 <nielsstunnebrink1@gmail.com>
Date: Wed, 18 Dec 2024 11:31:54 +0100
Subject: added particle begin lifespan rendering, added world_space to sprite
 so that coordinates are in camera_space or world_sapce

---
 src/crepe/api/Sprite.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'src/crepe/api/Sprite.h')

diff --git a/src/crepe/api/Sprite.h b/src/crepe/api/Sprite.h
index a2409c2..a3fc319 100644
--- a/src/crepe/api/Sprite.h
+++ b/src/crepe/api/Sprite.h
@@ -66,6 +66,16 @@ public:
 
 		//! independent sprite offset position
 		vec2 position_offset;
+
+		/**
+		 * \brief gives the user the option to render this in world space or in camera space
+		 *
+		 * - if true will this be rendered in world space this means that the sprite can be
+		 *   rendered off the screen 
+		 * - if false --> will the sprite be rendered in camera space. this means that the
+		 *   coordinates given on the \c Sprite and \c Transform will be inside the camera 
+		 */
+		bool world_space = true;
 	};
 
 public:
-- 
cgit v1.2.3


From 8ea70b897805ff84113758d45a4c5c1a171a77bd Mon Sep 17 00:00:00 2001
From: Loek Le Blansch <loek@pipeframe.xyz>
Date: Wed, 8 Jan 2025 13:14:37 +0100
Subject: implement sprite replay

---
 src/crepe/api/Sprite.cpp | 15 +++++++++++++++
 src/crepe/api/Sprite.h   | 10 ++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

(limited to 'src/crepe/api/Sprite.h')

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;
+}
diff --git a/src/crepe/api/Sprite.h b/src/crepe/api/Sprite.h
index a3fc319..3565bed 100644
--- a/src/crepe/api/Sprite.h
+++ b/src/crepe/api/Sprite.h
@@ -42,10 +42,10 @@ public:
 		FlipSettings flip;
 
 		//! Layer sorting level of the sprite
-		const int sorting_in_layer = 0;
+		int sorting_in_layer = 0;
 
 		//! Order within the sorting layer
-		const int order_in_layer = 0;
+		int order_in_layer = 0;
 
 		/**
 		 * \brief width and height of the sprite in game units
@@ -119,6 +119,12 @@ private:
 	//! Render area of the sprite this will also be adjusted by the AnimatorSystem if an Animator
 	// object is present in GameObject. this is in sprite pixels
 	Rect mask;
+
+protected:
+	virtual std::unique_ptr<Component> save() const;
+	Sprite(const Sprite &) = default;
+	virtual void restore(const Component & snapshot);
+	virtual Sprite & operator=(const Sprite &);
 };
 
 } // namespace crepe
-- 
cgit v1.2.3