From 1d4b3a44c9ce1e69f4f0e3909998225f8af3fea2 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Wed, 13 Nov 2024 19:00:29 +0100 Subject: fixed feedback --- src/crepe/system/ParticleSystem.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/crepe/system/ParticleSystem.h') diff --git a/src/crepe/system/ParticleSystem.h b/src/crepe/system/ParticleSystem.h index 3155df1..3a118fb 100644 --- a/src/crepe/system/ParticleSystem.h +++ b/src/crepe/system/ParticleSystem.h @@ -2,13 +2,15 @@ #include +#include "System.h" + namespace crepe { class ParticleEmitter; class Transform; /** * \brief ParticleSystem class responsible for managing particle emission, updates, and bounds checking. */ -class ParticleSystem { +class ParticleSystem : public System{ public: /** * \brief Default constructor. @@ -18,7 +20,7 @@ public: /** * \brief Updates all particle emitters by emitting particles, updating particle states, and checking bounds. */ - void update(); + void update() override; private: /** @@ -68,7 +70,7 @@ private: //! Counter to count updates to determine how many times emit_particle is called. uint32_t update_count = 0; //! Determines the lowest amount of emission rate (1000 = 0.001 = 1 particle per 1000 updates). - static constexpr uint32_t MAX_UPDATE_COUNT = 100; + static constexpr unsigned int MAX_UPDATE_COUNT = 100; }; } // namespace crepe -- cgit v1.2.3 From 9a95e6cb2c1f1255643d1b8996cd8eeb108c6f8c Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Wed, 13 Nov 2024 19:24:32 +0100 Subject: fixed issues --- src/crepe/api/ParticleEmitter.cpp | 1 - src/crepe/api/ParticleEmitter.h | 9 ++------- src/crepe/system/ParticleSystem.cpp | 2 -- src/crepe/system/ParticleSystem.h | 7 +------ 4 files changed, 3 insertions(+), 16 deletions(-) (limited to 'src/crepe/system/ParticleSystem.h') diff --git a/src/crepe/api/ParticleEmitter.cpp b/src/crepe/api/ParticleEmitter.cpp index 7032f9e..43d2e69 100644 --- a/src/crepe/api/ParticleEmitter.cpp +++ b/src/crepe/api/ParticleEmitter.cpp @@ -1,5 +1,4 @@ #include "ParticleEmitter.h" -#include "Particle.h" using namespace crepe; diff --git a/src/crepe/api/ParticleEmitter.h b/src/crepe/api/ParticleEmitter.h index 6e29e60..a9e872f 100644 --- a/src/crepe/api/ParticleEmitter.h +++ b/src/crepe/api/ParticleEmitter.h @@ -1,24 +1,21 @@ #pragma once -#include #include #include "Component.h" #include "Particle.h" -#include "Sprite.h" #include "Vector2.h" -// class Sprite; - namespace crepe { +class Sprite; + /** * \brief Data holder for particle emission parameters. * * The ParticleEmitter class stores configuration data for particle properties, * defining the characteristics and boundaries of particle emissions. */ - class ParticleEmitter : public Component { public: /** @@ -75,8 +72,6 @@ public: public: /** - * \brief Constructs a ParticleEmitter data holder with specified settings. - * * \param game_object_id Identifier for the game object using this emitter. * \param data Configuration data defining particle properties. */ diff --git a/src/crepe/system/ParticleSystem.cpp b/src/crepe/system/ParticleSystem.cpp index 4a25b47..e7a3bec 100644 --- a/src/crepe/system/ParticleSystem.cpp +++ b/src/crepe/system/ParticleSystem.cpp @@ -11,8 +11,6 @@ using namespace crepe; -ParticleSystem::ParticleSystem() {} - void ParticleSystem::update() { // Get all emitters ComponentManager & mgr = ComponentManager::get_instance(); diff --git a/src/crepe/system/ParticleSystem.h b/src/crepe/system/ParticleSystem.h index 3a118fb..664394e 100644 --- a/src/crepe/system/ParticleSystem.h +++ b/src/crepe/system/ParticleSystem.h @@ -12,11 +12,6 @@ class Transform; */ class ParticleSystem : public System{ public: - /** - * \brief Default constructor. - */ - ParticleSystem(); - /** * \brief Updates all particle emitters by emitting particles, updating particle states, and checking bounds. */ @@ -68,7 +63,7 @@ private: private: //! Counter to count updates to determine how many times emit_particle is called. - uint32_t update_count = 0; + unsigned int update_count = 0; //! Determines the lowest amount of emission rate (1000 = 0.001 = 1 particle per 1000 updates). static constexpr unsigned int MAX_UPDATE_COUNT = 100; }; -- cgit v1.2.3 From be1e97bc7a494963ab1567492fafcda99e36f683 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 13 Nov 2024 19:52:11 +0100 Subject: `make format` --- src/crepe/Particle.cpp | 4 ++-- src/crepe/Particle.h | 4 ++-- src/crepe/api/AssetManager.h | 3 ++- src/crepe/api/ParticleEmitter.cpp | 6 ++++-- src/crepe/facade/SDLContext.cpp | 2 +- src/crepe/system/ParticleSystem.h | 2 +- src/example/rendering.cpp | 4 +++- 7 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/crepe/system/ParticleSystem.h') diff --git a/src/crepe/Particle.cpp b/src/crepe/Particle.cpp index 1c3c138..582edf4 100644 --- a/src/crepe/Particle.cpp +++ b/src/crepe/Particle.cpp @@ -2,8 +2,8 @@ using namespace crepe; -void Particle::reset(uint32_t lifespan, const Vector2& position,const Vector2& velocity, - double angle) { +void Particle::reset(uint32_t lifespan, const Vector2 & position, + const Vector2 & velocity, double angle) { // Initialize the particle state this->time_in_life = 0; this->lifespan = lifespan; diff --git a/src/crepe/Particle.h b/src/crepe/Particle.h index 8782382..3eaebc3 100644 --- a/src/crepe/Particle.h +++ b/src/crepe/Particle.h @@ -43,8 +43,8 @@ public: * \param velocity The initial velocity of the particle. * \param angle The angle of the particle's trajectory or orientation. */ - void reset(uint32_t lifespan, const Vector2& position,const Vector2& velocity, - double angle); + void reset(uint32_t lifespan, const Vector2 & position, + const Vector2 & velocity, double angle); /** * \brief Updates the particle's state. * diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h index dbfaef3..86a9902 100644 --- a/src/crepe/api/AssetManager.h +++ b/src/crepe/api/AssetManager.h @@ -56,7 +56,8 @@ public: * cache. */ template - std::shared_ptr cache(const std::string & file_path, bool reload = false); + std::shared_ptr cache(const std::string & file_path, + bool reload = false); }; } // namespace crepe diff --git a/src/crepe/api/ParticleEmitter.cpp b/src/crepe/api/ParticleEmitter.cpp index 43d2e69..35f960d 100644 --- a/src/crepe/api/ParticleEmitter.cpp +++ b/src/crepe/api/ParticleEmitter.cpp @@ -2,8 +2,10 @@ using namespace crepe; -ParticleEmitter::ParticleEmitter(game_object_id_t game_object_id, const Data & data) - : Component(game_object_id), data(data) { +ParticleEmitter::ParticleEmitter(game_object_id_t game_object_id, + const Data & data) + : Component(game_object_id), + data(data) { for (size_t i = 0; i < this->data.max_particles; i++) { this->data.particles.emplace_back(); } diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index 46230b4..236bf8c 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -159,7 +159,7 @@ SDLContext::texture_from_path(const std::string & path) { SDL_Surface * tmp = IMG_Load(path.c_str()); if (tmp == nullptr) { - tmp = IMG_Load("../asset/texture/ERROR.png"); + tmp = IMG_Load("../asset/texture/ERROR.png"); } std::unique_ptr> diff --git a/src/crepe/system/ParticleSystem.h b/src/crepe/system/ParticleSystem.h index 664394e..d7ca148 100644 --- a/src/crepe/system/ParticleSystem.h +++ b/src/crepe/system/ParticleSystem.h @@ -10,7 +10,7 @@ class Transform; /** * \brief ParticleSystem class responsible for managing particle emission, updates, and bounds checking. */ -class ParticleSystem : public System{ +class ParticleSystem : public System { public: /** * \brief Updates all particle emitters by emitting particles, updating particle states, and checking bounds. diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp index e02f6a3..827ad07 100644 --- a/src/example/rendering.cpp +++ b/src/example/rendering.cpp @@ -34,7 +34,9 @@ int main() { } { Color color(0, 0, 0, 0); - obj1.add_component(make_shared("../asset/texture/second.png"), color, FlipSettings{true, true}); + obj1.add_component( + make_shared("../asset/texture/second.png"), color, + FlipSettings{true, true}); } /* -- cgit v1.2.3