aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-14 10:23:04 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-14 10:23:04 +0100
commit5e6b80ba9fe18143b994a301ab0ba1ba54072b43 (patch)
tree2784b5bdb49dba729884af5d4fd80dd9e44776d1 /src/crepe/api
parent767f40a61952892d60d204ecaaffa07e7e396d28 (diff)
Working color, fucked up git merge
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/AssetManager.h3
-rw-r--r--src/crepe/api/ParticleEmitter.cpp14
-rw-r--r--src/crepe/api/ParticleEmitter.h14
3 files changed, 10 insertions, 21 deletions
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 <typename T>
- std::shared_ptr<T> cache(const std::string & file_path, bool reload = false);
+ std::shared_ptr<T> 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 e7f298c..35f960d 100644
--- a/src/crepe/api/ParticleEmitter.cpp
+++ b/src/crepe/api/ParticleEmitter.cpp
@@ -1,18 +1,12 @@
#include "ParticleEmitter.h"
-#include "Particle.h"
using namespace crepe;
-ParticleEmitter::ParticleEmitter(uint32_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();
}
}
-
-ParticleEmitter::~ParticleEmitter() {
- std::vector<Particle>::iterator it = this->data.particles.begin();
- while (it != this->data.particles.end()) {
- it = this->data.particles.erase(it);
- }
-}
diff --git a/src/crepe/api/ParticleEmitter.h b/src/crepe/api/ParticleEmitter.h
index 83a1588..a9e872f 100644
--- a/src/crepe/api/ParticleEmitter.h
+++ b/src/crepe/api/ParticleEmitter.h
@@ -1,24 +1,21 @@
#pragma once
-#include <cstdint>
#include <vector>
#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:
/**
@@ -48,7 +45,7 @@ public:
//! position of the emitter
Vector2 position;
//! maximum number of particles
- const uint32_t max_particles = 0;
+ const unsigned int max_particles = 0;
//! rate of particle emission per update (Lowest value = 0.001 any lower is ignored)
double emission_rate = 0;
//! min speed of the particles
@@ -75,13 +72,10 @@ 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.
*/
- ParticleEmitter(uint32_t game_object_id, const Data & data);
- ~ParticleEmitter();
+ ParticleEmitter(game_object_id_t game_object_id, const Data & data);
public:
//! Configuration data for particle emission settings.