aboutsummaryrefslogtreecommitdiff
path: root/src/example/rendering_particle.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 14:33:08 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 14:33:08 +0100
commitd623b13dab63408cf5e99dbc453636f174bc6fe8 (patch)
treeb79bc7826adff02e7b3c8a2778370022182f4943 /src/example/rendering_particle.cpp
parent3344e0df01435be903e38ccbd3b9cee608d574e7 (diff)
fixxed bug with particleemiiter and sprite in single component
Diffstat (limited to 'src/example/rendering_particle.cpp')
-rw-r--r--src/example/rendering_particle.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp
index 3f71750..bcf95b8 100644
--- a/src/example/rendering_particle.cpp
+++ b/src/example/rendering_particle.cpp
@@ -15,6 +15,7 @@
#include <crepe/system/RenderSystem.h>
#include <chrono>
+#include <memory>
using namespace crepe;
using namespace std;
@@ -26,10 +27,12 @@ int main(int argc, char * argv[]) {
ParticleSystem psys{mgr};
Color color(255, 255, 255, 255);
+ game_object.add_component<Sprite>(make_shared<Texture>("../asset/texture/img.png"), color, FlipSettings{false,false});
+
Sprite test_sprite = game_object.add_component<Sprite>(
make_shared<Texture>("../asset/texture/img.png"), color, FlipSettings{false, false});
game_object.add_component<ParticleEmitter>(ParticleEmitter::Data{
- .position = {0, 0},
+ .position = {100, 0},
.max_particles = 10,
.emission_rate = 0.1,
.min_speed = 6,
@@ -46,9 +49,10 @@ int main(int argc, char * argv[]) {
.reset_on_exit = false,
},
.sprite = test_sprite,
- });
+ }).active = false;
game_object.add_component<Camera>(Color::get_white());
+
auto start = std::chrono::steady_clock::now();
while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) {
psys.update();