aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 14:50:08 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-17 14:50:08 +0100
commitc3c565f7c8d1e7e9899b8c2fbb1c313a45e4b10b (patch)
tree33b937a5c0cd3413078ac6fd9ccc82ee60763acd /src/test
parent4080a2eec207b35b36f7d0ceae7c2afcfcdfd977 (diff)
parent9232a98b72eee7af4f7f2153c1b2ccedbfa4cc65 (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/text-component
Diffstat (limited to 'src/test')
-rw-r--r--src/test/CollisionTest.cpp12
-rw-r--r--src/test/EventTest.cpp51
-rw-r--r--src/test/InputTest.cpp34
-rw-r--r--src/test/ParticleTest.cpp98
-rw-r--r--src/test/Profiling.cpp25
5 files changed, 108 insertions, 112 deletions
diff --git a/src/test/CollisionTest.cpp b/src/test/CollisionTest.cpp
index 2ad65fa..ff9e7cc 100644
--- a/src/test/CollisionTest.cpp
+++ b/src/test/CollisionTest.cpp
@@ -69,10 +69,10 @@ public:
.offset = {0, 0},
});
// Create a box with an inner size of 10x10 units
- world.add_component<BoxCollider>(vec2{0, -100}, vec2{100, 100}); // Top
- world.add_component<BoxCollider>(vec2{0, 100}, vec2{100, 100}); // Bottom
- world.add_component<BoxCollider>(vec2{-100, 0}, vec2{100, 100}); // Left
- world.add_component<BoxCollider>(vec2{100, 0}, vec2{100, 100}); // right
+ world.add_component<BoxCollider>(vec2{100, 100}, vec2{0, -100}); // Top
+ world.add_component<BoxCollider>(vec2{100, 100}, vec2{0, 100}); // Bottom
+ world.add_component<BoxCollider>(vec2{100, 100}, vec2{-100, 0}); // Left
+ world.add_component<BoxCollider>(vec2{100, 100}, vec2{100, 0}); // right
game_object1.add_component<Rigidbody>(Rigidbody::Data{
.mass = 1,
@@ -84,7 +84,7 @@ public:
.offset = {0, 0},
.collision_layers = {0},
});
- game_object1.add_component<BoxCollider>(vec2{0, 0}, vec2{10, 10});
+ game_object1.add_component<BoxCollider>(vec2{10, 10}, vec2{0, 0});
BehaviorScript & script_object1
= game_object1.add_component<BehaviorScript>().set_script<CollisionHandler>(1);
script_object1_ref = static_cast<CollisionHandler *>(script_object1.script.get());
@@ -100,7 +100,7 @@ public:
.offset = {0, 0},
.collision_layers = {0},
});
- game_object2.add_component<BoxCollider>(vec2{0, 0}, vec2{10, 10});
+ game_object2.add_component<BoxCollider>(vec2{10, 10}, vec2{0, 0});
BehaviorScript & script_object2
= game_object2.add_component<BehaviorScript>().set_script<CollisionHandler>(2);
script_object2_ref = static_cast<CollisionHandler *>(script_object2.script.get());
diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp
index 82272b5..f8be3fe 100644
--- a/src/test/EventTest.cpp
+++ b/src/test/EventTest.cpp
@@ -48,15 +48,14 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_all_channels) {
EventHandler<MouseClickEvent> mouse_handler = [&](const MouseClickEvent & e) {
triggered = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false;
};
event_mgr.subscribe<MouseClickEvent>(mouse_handler, EventManager::CHANNEL_ALL);
- MouseClickEvent click_event{
- .mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE};
+ MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE};
event_mgr.trigger_event<MouseClickEvent>(click_event, EventManager::CHANNEL_ALL);
EXPECT_TRUE(triggered);
@@ -66,15 +65,14 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_one_channel) {
int test_channel = 1;
EventHandler<MouseClickEvent> mouse_handler = [&](const MouseClickEvent & e) {
triggered = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false;
};
event_mgr.subscribe<MouseClickEvent>(mouse_handler, test_channel);
- MouseClickEvent click_event{
- .mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE};
+ MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE};
event_mgr.trigger_event<MouseClickEvent>(click_event, EventManager::CHANNEL_ALL);
EXPECT_FALSE(triggered);
@@ -90,23 +88,22 @@ TEST_F(EventManagerTest, EventManagerTest_callback_propagation) {
// Handlers
EventHandler<MouseClickEvent> mouse_handler_true = [&](const MouseClickEvent & e) {
triggered_true = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return true; // Stops propagation
};
EventHandler<MouseClickEvent> mouse_handler_false = [&](const MouseClickEvent & e) {
triggered_false = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false; // Allows propagation
};
// Test event
- MouseClickEvent click_event{
- .mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE};
+ MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE};
event_mgr.subscribe<MouseClickEvent>(mouse_handler_true, EventManager::CHANNEL_ALL);
event_mgr.subscribe<MouseClickEvent>(mouse_handler_false, EventManager::CHANNEL_ALL);
@@ -138,15 +135,15 @@ TEST_F(EventManagerTest, EventManagerTest_queue_dispatch) {
int test_channel = 1;
EventHandler<MouseClickEvent> mouse_handler1 = [&](const MouseClickEvent & e) {
triggered1 = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false; // Allows propagation
};
EventHandler<MouseClickEvent> mouse_handler2 = [&](const MouseClickEvent & e) {
triggered2 = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false; // Allows propagation
};
@@ -154,9 +151,9 @@ TEST_F(EventManagerTest, EventManagerTest_queue_dispatch) {
event_mgr.subscribe<MouseClickEvent>(mouse_handler2, test_channel);
event_mgr.queue_event<MouseClickEvent>(
- MouseClickEvent{.mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE});
+ MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE});
event_mgr.queue_event<MouseClickEvent>(
- MouseClickEvent{.mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE},
+ MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE},
test_channel);
event_mgr.dispatch_events();
EXPECT_TRUE(triggered1);
@@ -172,16 +169,16 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) {
// Define EventHandlers
EventHandler<MouseClickEvent> mouse_handler1 = [&](const MouseClickEvent & e) {
triggered1 = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false; // Allows propagation
};
EventHandler<MouseClickEvent> mouse_handler2 = [&](const MouseClickEvent & e) {
triggered2 = true;
- EXPECT_EQ(e.mouse_x, 100);
- EXPECT_EQ(e.mouse_y, 200);
+ EXPECT_EQ(e.mouse_pos.x, 100);
+ EXPECT_EQ(e.mouse_pos.y, 200);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false; // Allows propagation
};
@@ -191,7 +188,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) {
// Queue events
event_mgr.queue_event<MouseClickEvent>(
- MouseClickEvent{.mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE});
+ MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE});
// Dispatch events - both handlers should be triggered
event_mgr.dispatch_events();
@@ -207,7 +204,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) {
// Queue the same event again
event_mgr.queue_event<MouseClickEvent>(
- MouseClickEvent{.mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE});
+ MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE});
// Dispatch events - only handler 2 should be triggered, handler 1 should NOT
event_mgr.dispatch_events();
@@ -222,7 +219,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) {
// Queue the event again
event_mgr.queue_event<MouseClickEvent>(
- MouseClickEvent{.mouse_x = 100, .mouse_y = 200, .button = MouseButton::LEFT_MOUSE});
+ MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE});
// Dispatch events - no handler should be triggered
event_mgr.dispatch_events();
diff --git a/src/test/InputTest.cpp b/src/test/InputTest.cpp
index 8b40cea..d893276 100644
--- a/src/test/InputTest.cpp
+++ b/src/test/InputTest.cpp
@@ -15,6 +15,7 @@
#include <crepe/api/Metadata.h>
#include <crepe/api/Transform.h>
#include <crepe/api/Vector2.h>
+#include <crepe/facade/SDLContext.h>
#include <gmock/gmock.h>
using namespace std;
@@ -43,7 +44,7 @@ protected:
//mediator.component_manager = mgr;
//event_manager.clear();
}
-
+ void TearDown() override {}
void simulate_mouse_click(int mouse_x, int mouse_y, Uint8 mouse_button) {
SDL_Event event;
@@ -70,8 +71,8 @@ TEST_F(InputTest, MouseDown) {
EventHandler<MousePressEvent> on_mouse_down = [&](const MousePressEvent & event) {
mouse_triggered = true;
//middle of the screen = 0,0
- EXPECT_EQ(event.mouse_x, 0);
- EXPECT_EQ(event.mouse_y, 0);
+ EXPECT_EQ(event.mouse_pos.x, 0);
+ EXPECT_EQ(event.mouse_pos.y, 0);
EXPECT_EQ(event.button, MouseButton::LEFT_MOUSE);
return false;
};
@@ -95,8 +96,8 @@ TEST_F(InputTest, MouseUp) {
bool function_triggered = false;
EventHandler<MouseReleaseEvent> on_mouse_release = [&](const MouseReleaseEvent & e) {
function_triggered = true;
- EXPECT_EQ(e.mouse_x, 0);
- EXPECT_EQ(e.mouse_y, 0);
+ EXPECT_EQ(e.mouse_pos.x, 0);
+ EXPECT_EQ(e.mouse_pos.y, 0);
EXPECT_EQ(e.button, MouseButton::LEFT_MOUSE);
return false;
};
@@ -119,10 +120,10 @@ TEST_F(InputTest, MouseMove) {
bool function_triggered = false;
EventHandler<MouseMoveEvent> on_mouse_move = [&](const MouseMoveEvent & e) {
function_triggered = true;
- EXPECT_EQ(e.mouse_x, 0);
- EXPECT_EQ(e.mouse_y, 0);
- EXPECT_EQ(e.delta_x, 10);
- EXPECT_EQ(e.delta_y, 10);
+ EXPECT_EQ(e.mouse_pos.x, 0);
+ EXPECT_EQ(e.mouse_pos.y, 0);
+ EXPECT_EQ(e.mouse_delta.x, 10);
+ EXPECT_EQ(e.mouse_delta.y, 10);
return false;
};
event_manager.subscribe<MouseMoveEvent>(on_mouse_move);
@@ -193,8 +194,8 @@ TEST_F(InputTest, MouseClick) {
EventHandler<MouseClickEvent> on_mouse_click = [&](const MouseClickEvent & event) {
on_click_triggered = true;
EXPECT_EQ(event.button, MouseButton::LEFT_MOUSE);
- EXPECT_EQ(event.mouse_x, 0);
- EXPECT_EQ(event.mouse_y, 0);
+ EXPECT_EQ(event.mouse_pos.x, 0);
+ EXPECT_EQ(event.mouse_pos.y, 0);
return false;
};
event_manager.subscribe<MouseClickEvent>(on_mouse_click);
@@ -209,14 +210,10 @@ TEST_F(InputTest, testButtonClick) {
GameObject button_obj = mgr.new_object("body", "person", vec2{0, 0}, 0, 1);
bool button_clicked = false;
std::function<void()> on_click = [&]() { button_clicked = true; };
- auto & button
- = button_obj.add_component<Button>(vec2{100, 100}, vec2{0, 0}, on_click, false);
+ auto & button = button_obj.add_component<Button>(vec2{100, 100}, vec2{0, 0}, on_click);
bool hover = false;
button.active = true;
-
- button.is_pressed = false;
- button.is_toggle = false;
this->simulate_mouse_click(999, 999, SDL_BUTTON_LEFT);
input_system.update();
event_manager.dispatch_events();
@@ -232,11 +229,8 @@ TEST_F(InputTest, testButtonHover) {
GameObject button_obj = mgr.new_object("body", "person", vec2{0, 0}, 0, 1);
bool button_clicked = false;
std::function<void()> on_click = [&]() { button_clicked = true; };
- auto & button
- = button_obj.add_component<Button>(vec2{100, 100}, vec2{0, 0}, on_click, false);
+ auto & button = button_obj.add_component<Button>(vec2{100, 100}, vec2{0, 0}, on_click);
button.active = true;
- button.is_pressed = false;
- button.is_toggle = false;
// Mouse not on button
SDL_Event event;
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp
index 9112a3f..9263e00 100644
--- a/src/test/ParticleTest.cpp
+++ b/src/test/ParticleTest.cpp
@@ -1,15 +1,18 @@
#include "api/Asset.h"
-#include <crepe/Particle.h>
#include <crepe/api/Config.h>
#include <crepe/api/GameObject.h>
-#include <crepe/api/ParticleEmitter.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Sprite.h>
#include <crepe/api/Transform.h>
#include <crepe/manager/ComponentManager.h>
-#include <crepe/system/ParticleSystem.h>
+#include <crepe/manager/LoopTimerManager.h>
#include <gtest/gtest.h>
#include <math.h>
+#define protected public
+#define private public
+#include <crepe/Particle.h>
+#include <crepe/api/ParticleEmitter.h>
+#include <crepe/system/ParticleSystem.h>
using namespace std;
using namespace std::chrono_literals;
@@ -21,6 +24,7 @@ class ParticlesTest : public ::testing::Test {
public:
ComponentManager component_manager{m};
ParticleSystem particle_system{m};
+ LoopTimerManager loop_timer{m};
void SetUp() override {
ComponentManager & mgr = this->component_manager;
@@ -38,25 +42,25 @@ public:
.size = {10, 10},
});
- game_object.add_component<ParticleEmitter>(ParticleEmitter::Data{
- .position = {0, 0},
- .max_particles = 100,
- .emission_rate = 0,
- .min_speed = 0,
- .max_speed = 0,
- .min_angle = 0,
- .max_angle = 0,
- .begin_lifespan = 0,
- .end_lifespan = 0,
- .force_over_time = vec2{0, 0},
- .boundary{
- .width = 0,
- .height = 0,
- .offset = vec2{0, 0},
- .reset_on_exit = false,
- },
- .sprite = test_sprite,
- });
+ game_object.add_component<ParticleEmitter>(test_sprite,
+ ParticleEmitter::Data{
+ .offset = {0, 0},
+ .max_particles = 100,
+ .emission_rate = 0,
+ .min_speed = 0,
+ .max_speed = 0,
+ .min_angle = 0,
+ .max_angle = 0,
+ .begin_lifespan = 0,
+ .end_lifespan = 0,
+ .force_over_time = vec2{0, 0},
+ .boundary{
+ .width = 0,
+ .height = 0,
+ .offset = vec2{0, 0},
+ .reset_on_exit = false,
+ },
+ });
}
transforms = mgr.get_components_by_id<Transform>(0);
Transform & transform = transforms.front().get();
@@ -66,7 +70,7 @@ public:
std::vector<std::reference_wrapper<ParticleEmitter>> rigidbodies
= mgr.get_components_by_id<ParticleEmitter>(0);
ParticleEmitter & emitter = rigidbodies.front().get();
- emitter.data.position = {0, 0};
+ emitter.data.offset = {0, 0};
emitter.data.emission_rate = 0;
emitter.data.min_speed = 0;
emitter.data.max_speed = 0;
@@ -76,7 +80,7 @@ public:
emitter.data.end_lifespan = 0;
emitter.data.force_over_time = vec2{0, 0};
emitter.data.boundary = {0, 0, vec2{0, 0}, false};
- for (auto & particle : emitter.data.particles) {
+ for (auto & particle : emitter.particles) {
particle.active = false;
}
}
@@ -95,19 +99,19 @@ TEST_F(ParticlesTest, spawnParticle) {
emitter.data.max_angle = 10;
particle_system.update();
//check if nothing happend
- EXPECT_EQ(emitter.data.particles[0].active, false);
- emitter.data.emission_rate = 1;
+ EXPECT_EQ(emitter.particles[0].active, false);
+ emitter.data.emission_rate = 50;
//check particle spawnes
particle_system.update();
- EXPECT_EQ(emitter.data.particles[0].active, true);
+ EXPECT_EQ(emitter.particles[0].active, true);
particle_system.update();
- EXPECT_EQ(emitter.data.particles[1].active, true);
+ EXPECT_EQ(emitter.particles[1].active, true);
particle_system.update();
- EXPECT_EQ(emitter.data.particles[2].active, true);
+ EXPECT_EQ(emitter.particles[2].active, true);
particle_system.update();
- EXPECT_EQ(emitter.data.particles[3].active, true);
+ EXPECT_EQ(emitter.particles[3].active, true);
- for (auto & particle : emitter.data.particles) {
+ for (auto & particle : emitter.particles) {
// Check velocity range
EXPECT_GE(particle.velocity.x, emitter.data.min_speed);
// Speed should be greater than or equal to min_speed
@@ -133,13 +137,13 @@ TEST_F(ParticlesTest, moveParticleHorizontal) {
emitter.data.end_lifespan = 100;
emitter.data.boundary.height = 100;
emitter.data.boundary.width = 100;
- emitter.data.min_speed = 1;
- emitter.data.max_speed = 1;
+ emitter.data.min_speed = 50;
+ emitter.data.max_speed = 50;
emitter.data.max_angle = 0;
- emitter.data.emission_rate = 1;
+ emitter.data.emission_rate = 50;
for (int a = 1; a < emitter.data.boundary.width / 2; a++) {
particle_system.update();
- EXPECT_EQ(emitter.data.particles[0].position.x, a);
+ EXPECT_EQ(emitter.particles[0].position.x, a);
}
}
@@ -150,14 +154,14 @@ TEST_F(ParticlesTest, moveParticleVertical) {
emitter.data.end_lifespan = 100;
emitter.data.boundary.height = 100;
emitter.data.boundary.width = 100;
- emitter.data.min_speed = 1;
- emitter.data.max_speed = 1;
+ emitter.data.min_speed = 50;
+ emitter.data.max_speed = 50;
emitter.data.min_angle = 90;
emitter.data.max_angle = 90;
- emitter.data.emission_rate = 1;
+ emitter.data.emission_rate = 50;
for (int a = 1; a < emitter.data.boundary.width / 2; a++) {
particle_system.update();
- EXPECT_EQ(emitter.data.particles[0].position.y, a);
+ EXPECT_EQ(emitter.particles[0].position.y, a);
}
}
@@ -177,7 +181,7 @@ TEST_F(ParticlesTest, boundaryParticleReset) {
for (int a = 0; a < emitter.data.boundary.width / 2 + 1; a++) {
particle_system.update();
}
- EXPECT_EQ(emitter.data.particles[0].active, false);
+ EXPECT_EQ(emitter.particles[0].active, false);
}
TEST_F(ParticlesTest, boundaryParticleStop) {
@@ -197,12 +201,12 @@ TEST_F(ParticlesTest, boundaryParticleStop) {
particle_system.update();
}
const double TOLERANCE = 0.01;
- EXPECT_NEAR(emitter.data.particles[0].velocity.x, 0, TOLERANCE);
- EXPECT_NEAR(emitter.data.particles[0].velocity.y, 0, TOLERANCE);
- if (emitter.data.particles[0].velocity.x != 0)
- EXPECT_NEAR(std::abs(emitter.data.particles[0].position.x),
+ EXPECT_NEAR(emitter.particles[0].velocity.x, 0, TOLERANCE);
+ EXPECT_NEAR(emitter.particles[0].velocity.y, 0, TOLERANCE);
+ if (emitter.particles[0].velocity.x != 0)
+ EXPECT_NEAR(std::abs(emitter.particles[0].position.x),
emitter.data.boundary.height / 2, TOLERANCE);
- if (emitter.data.particles[0].velocity.y != 0)
- EXPECT_NEAR(std::abs(emitter.data.particles[0].position.y),
- emitter.data.boundary.width / 2, TOLERANCE);
+ if (emitter.particles[0].velocity.y != 0)
+ EXPECT_NEAR(std::abs(emitter.particles[0].position.y), emitter.data.boundary.width / 2,
+ TOLERANCE);
}
diff --git a/src/test/Profiling.cpp b/src/test/Profiling.cpp
index 35f52dc..16736b8 100644
--- a/src/test/Profiling.cpp
+++ b/src/test/Profiling.cpp
@@ -219,18 +219,19 @@ TEST_F(DISABLED_ProfilingTest, Profiling_3) {
.order_in_layer = 1,
.size = {.y = 500},
});
- auto & test = gameobject.add_component<ParticleEmitter>(ParticleEmitter::Data{
- .max_particles = 10,
- .emission_rate = 100,
- .end_lifespan = 100000,
- .boundary{
- .width = 1000,
- .height = 1000,
- .offset = vec2{0, 0},
- .reset_on_exit = false,
- },
- .sprite = test_sprite,
- });
+ auto & test = gameobject.add_component<ParticleEmitter>(
+ test_sprite, ParticleEmitter::Data{
+ .max_particles = 10,
+ .emission_rate = 100,
+ .end_lifespan = 100000,
+ .boundary{
+ .width = 1000,
+ .height = 1000,
+ .offset = vec2{0, 0},
+ .reset_on_exit = false,
+ },
+
+ });
}
render_sys.update();
this->game_object_count++;