aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 15:42:55 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-20 15:42:55 +0100
commitccb9dd63c6fc172fed9acaea31a6d67c457b37fe (patch)
tree38e56b5f8a9e248bc180be23c77d085b2b38ad65 /src/example
parenta0f39be4510665614d25d23d88fe1d0f0b5cc740 (diff)
fixed the reference bug in render particle, it was in the example problem
Diffstat (limited to 'src/example')
-rw-r--r--src/example/rendering_particle.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/example/rendering_particle.cpp b/src/example/rendering_particle.cpp
index 062f11f..5030bc6 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 <iostream>
#include <memory>
using namespace crepe;
@@ -27,11 +28,11 @@ 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>(
+ 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{
+ test_sprite.order_in_layer = 5;
+ auto test = game_object.add_component<ParticleEmitter>(ParticleEmitter::Data{
.position = {0, 0},
.max_particles = 10,
.emission_rate = 0.1,
@@ -52,6 +53,11 @@ int main(int argc, char * argv[]) {
});
game_object.add_component<Camera>(Color::WHITE);
+ game_object
+ .add_component<Sprite>(make_shared<Texture>("../asset/texture/img.png"), color,
+ FlipSettings{false, false})
+ .order_in_layer
+ = 6;
auto start = std::chrono::steady_clock::now();
while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) {