diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 11:26:12 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-14 11:26:12 +0100 |
commit | 01c09a196c3f3e5cefaa4119a95a1cdeb7b9c263 (patch) | |
tree | 5667369a85bd06b683c67de42bf0311c2647912b /src/test/ParticleTest.cpp | |
parent | 6e13510f3c6d4155707f748d237bb1fa05243450 (diff) | |
parent | 8600b8a29351aae26ec7b22f84aeeef92d8cb421 (diff) |
merge `loek/cleanup` into `loek/audio`
Diffstat (limited to 'src/test/ParticleTest.cpp')
-rw-r--r-- | src/test/ParticleTest.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp index 6fe3133..1a89e3a 100644 --- a/src/test/ParticleTest.cpp +++ b/src/test/ParticleTest.cpp @@ -16,15 +16,16 @@ using namespace std::chrono_literals; using namespace crepe; class ParticlesTest : public ::testing::Test { -protected: - ParticleSystem particle_system; +public: + ComponentManager component_manager; + ParticleSystem particle_system{component_manager}; + void SetUp() override { - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; std::vector<std::reference_wrapper<Transform>> transforms = mgr.get_components_by_id<Transform>(0); if (transforms.empty()) { - - GameObject game_object(0, "", "", Vector2{0, 0}, 0, 0); + GameObject game_object = mgr.new_object("", "", Vector2{0, 0}, 0, 0); Color color(0, 0, 0, 0); Sprite test_sprite = game_object.add_component<Sprite>( @@ -77,7 +78,7 @@ protected: TEST_F(ParticlesTest, spawnParticle) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 5; @@ -122,7 +123,7 @@ TEST_F(ParticlesTest, spawnParticle) { TEST_F(ParticlesTest, moveParticleHorizontal) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; @@ -140,7 +141,7 @@ TEST_F(ParticlesTest, moveParticleHorizontal) { TEST_F(ParticlesTest, moveParticleVertical) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; @@ -159,7 +160,7 @@ TEST_F(ParticlesTest, moveParticleVertical) { TEST_F(ParticlesTest, boundaryParticleReset) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; @@ -179,7 +180,7 @@ TEST_F(ParticlesTest, boundaryParticleReset) { TEST_F(ParticlesTest, boundaryParticleStop) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); + ComponentManager & mgr = this->component_manager; ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; |