aboutsummaryrefslogtreecommitdiff
path: root/src/example/game.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 19:16:25 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 19:16:25 +0100
commitb421eec1073c1fb4b99d46cc36c5c9cbd8d3c4a7 (patch)
tree461e290e0c2c3adf588f02d24031edc7f8114390 /src/example/game.cpp
parentc4c896c2995f2b74fca322736aa944b28b14a1f6 (diff)
parenta8ccf7fe8662086bb223aa4eafd0f85e717d16cf (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/button-improvement
Diffstat (limited to 'src/example/game.cpp')
-rw-r--r--src/example/game.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp
index 61f8760..22effd2 100644
--- a/src/example/game.cpp
+++ b/src/example/game.cpp
@@ -1,4 +1,5 @@
#include "api/CircleCollider.h"
+#include "api/ParticleEmitter.h"
#include "api/Scene.h"
#include "manager/ComponentManager.h"
#include "manager/Mediator.h"
@@ -258,6 +259,25 @@ public:
})
.active
= false;
+ Asset img5{"asset/texture/square.png"};
+
+ GameObject particle = new_object(
+ "Name", "Tag", vec2{screen_size_width / 2, screen_size_height / 2}, 0, 1);
+ auto & particle_image = particle.add_component<Sprite>(img5, Sprite::Data{
+ .size = {5, 5},
+ });
+ auto & test
+ = particle.add_component<ParticleEmitter>(particle_image, ParticleEmitter::Data{
+ .offset = {0, 0},
+ .max_particles = 256,
+ .emission_rate = 1,
+ .min_speed = 10,
+ .max_speed = 20,
+ .min_angle = -20,
+ .max_angle = 20,
+ .begin_lifespan = 0,
+ .end_lifespan = 5,
+ });
}
string get_name() const { return "scene1"; }