diff options
-rw-r--r-- | src/crepe/api/Vector2.cpp | 6 | ||||
-rw-r--r-- | src/crepe/api/Vector2.h | 10 | ||||
-rw-r--r-- | src/crepe/system/ParticleSystem.cpp | 2 | ||||
-rw-r--r-- | src/example/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/example/particles.cpp | 5 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/crepe/api/Vector2.cpp b/src/crepe/api/Vector2.cpp index 09bb59b..09b3fa3 100644 --- a/src/crepe/api/Vector2.cpp +++ b/src/crepe/api/Vector2.cpp @@ -3,7 +3,7 @@ namespace crepe { // Constructor with initial values -Vector2::Vector2(float x, float y) : x(x), y(y) {} +Vector2::Vector2(double x, double y) : x(x), y(y) {} // Subtracts another vector from this vector and returns the result. Vector2 Vector2::operator-(const Vector2 & other) const { @@ -16,7 +16,7 @@ Vector2 Vector2::operator+(const Vector2 & other) const { } // Multiplies this vector by a scalar and returns the result. -Vector2 Vector2::operator*(float scalar) const { +Vector2 Vector2::operator*(double scalar) const { return {x * scalar, y * scalar}; } @@ -35,7 +35,7 @@ Vector2 & Vector2::operator+=(const Vector2 & other) { } // Adds a scalar value to both components of this vector and updates this vector. -Vector2 & Vector2::operator+=(float other) { +Vector2 & Vector2::operator+=(double other) { x += other; y += other; return *this; diff --git a/src/crepe/api/Vector2.h b/src/crepe/api/Vector2.h index 741951b..5a57484 100644 --- a/src/crepe/api/Vector2.h +++ b/src/crepe/api/Vector2.h @@ -6,15 +6,15 @@ namespace crepe { class Vector2 { public: //! X component of the vector - float x; + double x; //! Y component of the vector - float y; + double y; //! Default constructor Vector2() = default; //! Constructor with initial values - Vector2(float x, float y); + Vector2(double x, double y); //! Subtracts another vector from this vector and returns the result. Vector2 operator-(const Vector2 & other) const; @@ -23,7 +23,7 @@ public: Vector2 operator+(const Vector2 & other) const; //! Multiplies this vector by a scalar and returns the result. - Vector2 operator*(float scalar) const; + Vector2 operator*(double scalar) const; //! Multiplies this vector by another vector element-wise and updates this vector. Vector2 & operator*=(const Vector2 & other); @@ -32,7 +32,7 @@ public: Vector2 & operator+=(const Vector2 & other); //! Adds a scalar value to both components of this vector and updates this vector. - Vector2 & operator+=(float other); + Vector2 & operator+=(double other); //! Returns the negation of this vector. Vector2 operator-() const; diff --git a/src/crepe/system/ParticleSystem.cpp b/src/crepe/system/ParticleSystem.cpp index 23534a3..b2fe829 100644 --- a/src/crepe/system/ParticleSystem.cpp +++ b/src/crepe/system/ParticleSystem.cpp @@ -22,7 +22,7 @@ void ParticleSystem::update() { for (ParticleEmitter & emitter : emitters) { // Get transform linked to emitter - const Transform& transform = mgr.get_components_by_id<Transform>(emitter.GAME_OBJECT_ID).front().get(); + const Transform& transform = mgr.get_components_by_id<Transform>(emitter.game_object_id).front().get(); // Check if within boundary check_bounds(emitter,transform); diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt index 36f9d4d..722ffea 100644 --- a/src/example/CMakeLists.txt +++ b/src/example/CMakeLists.txt @@ -28,4 +28,5 @@ add_example(proxy) add_example(db) add_example(ecs) add_example(scene_manager) +add_example(particles) diff --git a/src/example/particles.cpp b/src/example/particles.cpp index a56ec5c..bcff48f 100644 --- a/src/example/particles.cpp +++ b/src/example/particles.cpp @@ -3,7 +3,6 @@ #include <crepe/system/CollisionSystem.h> #include <crepe/api/AssetManager.h> #include <crepe/system/PhysicsSystem.h> -#include <crepe/api/loopManager.h> #include <crepe/Component.h> #include <crepe/api/GameObject.h> @@ -32,11 +31,11 @@ int main(int argc, char * argv[]) { .max_angle = 0, .begin_lifespan = 0, .end_lifespan = 0, - .force_over_time = 0, + .force_over_time = Vector2{0,0}, .boundary{ .boundary_width = 0, .boundary_height = 0, - .boundary_offset = {0,0}, + .boundary_offset = Vector2{0,0}, .reset_on_exit = false, }, .sprite = nullptr, |