diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-19 20:49:09 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-19 20:49:09 +0100 |
commit | 0f9f379a4dec7ad9d1dce30af5e2259931692c5f (patch) | |
tree | d84a76559d99fd6a3541d0087538564d79e39470 /src/test/ParticleTest.cpp | |
parent | 38a2476bcfa41b6d83a9a72d35f5acb684dc87fd (diff) | |
parent | 0476a8e9dbe7afb422862f7b1c15aaed7f3c416e (diff) |
merge with master
Diffstat (limited to 'src/test/ParticleTest.cpp')
-rw-r--r-- | src/test/ParticleTest.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/test/ParticleTest.cpp b/src/test/ParticleTest.cpp index 6fe3133..4e655a9 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,9 +78,8 @@ protected: TEST_F(ParticlesTest, spawnParticle) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); - ParticleEmitter & emitter - = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); + ComponentManager & mgr = this->component_manager; + ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 5; emitter.data.boundary.height = 100; emitter.data.boundary.width = 100; @@ -122,9 +122,8 @@ TEST_F(ParticlesTest, spawnParticle) { TEST_F(ParticlesTest, moveParticleHorizontal) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); - ParticleEmitter & emitter - = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); + ComponentManager & mgr = this->component_manager; + ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; emitter.data.boundary.height = 100; emitter.data.boundary.width = 100; @@ -140,9 +139,8 @@ TEST_F(ParticlesTest, moveParticleHorizontal) { TEST_F(ParticlesTest, moveParticleVertical) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); - ParticleEmitter & emitter - = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); + ComponentManager & mgr = this->component_manager; + ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; emitter.data.boundary.height = 100; emitter.data.boundary.width = 100; @@ -159,9 +157,8 @@ TEST_F(ParticlesTest, moveParticleVertical) { TEST_F(ParticlesTest, boundaryParticleReset) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); - ParticleEmitter & emitter - = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); + ComponentManager & mgr = this->component_manager; + ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; emitter.data.boundary.height = 10; emitter.data.boundary.width = 10; @@ -179,9 +176,8 @@ TEST_F(ParticlesTest, boundaryParticleReset) { TEST_F(ParticlesTest, boundaryParticleStop) { Config::get_instance().physics.gravity = 1; - ComponentManager & mgr = ComponentManager::get_instance(); - ParticleEmitter & emitter - = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); + ComponentManager & mgr = this->component_manager; + ParticleEmitter & emitter = mgr.get_components_by_id<ParticleEmitter>(0).front().get(); emitter.data.end_lifespan = 100; emitter.data.boundary.height = 10; emitter.data.boundary.width = 10; |