Sdk/BaseSystem: Fix udpate with max update rate + unit tests

This commit is contained in:
Lynix
2017-09-22 21:01:25 +02:00
parent cc4fdf2476
commit f95fc332f1
8 changed files with 18 additions and 7 deletions

View File

@@ -19,6 +19,8 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
Ndk::NodeComponent& nodeComponent = movingEntity->GetComponent<Ndk::NodeComponent>();
Ndk::PhysicsComponent2D& physicsComponent2D = movingEntity->AddComponent<Ndk::PhysicsComponent2D>();
world.GetSystem<Ndk::PhysicsSystem2D>().SetFixedUpdateRate(30.f);
WHEN("We update the world")
{
world.Update(1.f);
@@ -77,6 +79,8 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
Ndk::NodeComponent& nodeComponent = movingEntity->GetComponent<Ndk::NodeComponent>();
Ndk::PhysicsComponent2D& physicsComponent2D = movingEntity->AddComponent<Ndk::PhysicsComponent2D>();
world.GetSystem<Ndk::PhysicsSystem2D>().SetFixedUpdateRate(30.f);
WHEN("We make rotate our entity")
{
float angularSpeed = Nz::FromDegrees(45.f);
@@ -119,6 +123,8 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
Ndk::NodeComponent& nodeComponent = movingEntity->GetComponent<Ndk::NodeComponent>();
Ndk::PhysicsComponent2D& physicsComponent2D = movingEntity->AddComponent<Ndk::PhysicsComponent2D>();
world.GetSystem<Ndk::PhysicsSystem2D>().SetFixedUpdateRate(30.f);
WHEN("We make rotate our entity")
{
float angularSpeed = Nz::FromDegrees(45.f);

View File

@@ -13,6 +13,8 @@ SCENARIO("VelocitySystem", "[NDK][VELOCITYSYSTEM]")
Ndk::VelocityComponent& velocityComponent = entity->AddComponent<Ndk::VelocityComponent>();
Ndk::NodeComponent& nodeComponent = entity->AddComponent<Ndk::NodeComponent>();
world.GetSystem<Ndk::VelocitySystem>().SetFixedUpdateRate(30.f);
WHEN("We give a speed to our entity")
{
Nz::Vector3f velocity = Nz::Vector3f::Unit() * 2.f;