diff options
Diffstat (limited to 'src/test/Profiling.cpp')
-rw-r--r-- | src/test/Profiling.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/test/Profiling.cpp b/src/test/Profiling.cpp index 35f52dc..45f6d4c 100644 --- a/src/test/Profiling.cpp +++ b/src/test/Profiling.cpp @@ -39,7 +39,7 @@ class TestScript : public Script { subscribe<CollisionEvent>( [this](const CollisionEvent & ev) -> bool { return this->oncollision(ev); }); } - void update() { + void fixed_update() { // Retrieve component from the same GameObject this script is on } }; @@ -75,16 +75,15 @@ public: void SetUp() override { GameObject do_not_use = mgr.new_object("DO_NOT_USE", "", {0, 0}); - do_not_use.add_component<Camera>(ivec2{1080, 720}, vec2{2000, 2000}, - Camera::Data{ + do_not_use.add_component<Camera>(vec2{2000, 2000}, Camera::Data{ .bg_color = Color::WHITE, .zoom = 1.0f, }); // initialize systems here: //calls init - script_sys.update(); + script_sys.fixed_update(); //creates window - render_sys.update(); + render_sys.frame_update(); } // Helper function to time an update call and store its duration @@ -102,12 +101,14 @@ public: // Run and profile all systems, return the total time in milliseconds std::chrono::microseconds run_all_systems() { std::chrono::microseconds total_microseconds = 0us; - total_microseconds += time_function("PhysicsSystem", [&]() { physics_sys.update(); }); total_microseconds - += time_function("CollisionSystem", [&]() { collision_sys.update(); }); + += time_function("PhysicsSystem", [&]() { physics_sys.fixed_update(); }); total_microseconds - += time_function("ParticleSystem", [&]() { particle_sys.update(); }); - total_microseconds += time_function("RenderSystem", [&]() { render_sys.update(); }); + += time_function("CollisionSystem", [&]() { collision_sys.fixed_update(); }); + total_microseconds + += time_function("ParticleSystem", [&]() { particle_sys.fixed_update(); }); + total_microseconds + += time_function("RenderSystem", [&]() { render_sys.frame_update(); }); return total_microseconds; } @@ -219,7 +220,7 @@ TEST_F(DISABLED_ProfilingTest, Profiling_3) { .order_in_layer = 1, .size = {.y = 500}, }); - auto & test = gameobject.add_component<ParticleEmitter>(ParticleEmitter::Data{ + auto & test = gameobject.add_component<ParticleEmitter>(test_sprite, ParticleEmitter::Data{ .max_particles = 10, .emission_rate = 100, .end_lifespan = 100000, @@ -229,10 +230,9 @@ TEST_F(DISABLED_ProfilingTest, Profiling_3) { .offset = vec2{0, 0}, .reset_on_exit = false, }, - .sprite = test_sprite, }); } - render_sys.update(); + render_sys.frame_update(); this->game_object_count++; this->total_time = 0us; |