Add tests and SDK
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <NazaraSDK/Components/CollisionComponent2D.hpp>
|
||||
#include <NazaraSDK/Components/NodeComponent.hpp>
|
||||
#include <NazaraSDK/Components/PhysicsComponent2D.hpp>
|
||||
#include <NazaraSDK/Systems/PhysicsSystem2D.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
#include <limits>
|
||||
|
||||
@@ -13,6 +14,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
|
||||
GIVEN("A world and an entity")
|
||||
{
|
||||
Ndk::World world;
|
||||
world.AddSystem<Ndk::PhysicsSystem2D>();
|
||||
|
||||
Nz::Vector2f position(2.f, 3.f);
|
||||
Nz::Rectf movingAABB(0.f, 0.f, 16.f, 18.f);
|
||||
@@ -74,6 +76,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
|
||||
GIVEN("A world and a simple entity")
|
||||
{
|
||||
Ndk::World world;
|
||||
world.AddSystem<Ndk::PhysicsSystem2D>();
|
||||
|
||||
Nz::Vector2f position(0.f, 0.f);
|
||||
Nz::Rectf movingAABB(0.f, 0.f, 1.f, 2.f);
|
||||
@@ -120,6 +123,7 @@ SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]")
|
||||
GIVEN("A world and a simple entity not at the origin")
|
||||
{
|
||||
Ndk::World world;
|
||||
world.AddSystem<Ndk::PhysicsSystem2D>();
|
||||
|
||||
Nz::Vector2f position(3.f, 4.f);
|
||||
Nz::Rectf movingAABB(0.f, 0.f, 1.f, 2.f);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <NazaraSDK/Components/CollisionComponent3D.hpp>
|
||||
#include <NazaraSDK/Components/NodeComponent.hpp>
|
||||
#include <NazaraSDK/Components/PhysicsComponent3D.hpp>
|
||||
#include <NazaraSDK/Systems/PhysicsSystem3D.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
SCENARIO("PhysicsSystem3D", "[NDK][PHYSICSSYSTEM3D]")
|
||||
@@ -10,6 +11,8 @@ SCENARIO("PhysicsSystem3D", "[NDK][PHYSICSSYSTEM3D]")
|
||||
GIVEN("A world and a static entity & a dynamic entity")
|
||||
{
|
||||
Ndk::World world;
|
||||
world.AddSystem<Ndk::PhysicsSystem3D>();
|
||||
|
||||
const Ndk::EntityHandle& staticEntity = world.CreateEntity();
|
||||
Ndk::CollisionComponent3D& collisionComponentStatic = staticEntity->AddComponent<Ndk::CollisionComponent3D>();
|
||||
Ndk::NodeComponent& nodeComponentStatic = staticEntity->AddComponent<Ndk::NodeComponent>();
|
||||
@@ -31,4 +34,4 @@ SCENARIO("PhysicsSystem3D", "[NDK][PHYSICSSYSTEM3D]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ 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);
|
||||
world.AddSystem<Ndk::VelocitySystem>().SetFixedUpdateRate(30.f);
|
||||
|
||||
WHEN("We give a speed to our entity")
|
||||
{
|
||||
@@ -27,4 +27,4 @@ SCENARIO("VelocitySystem", "[NDK][VELOCITYSYSTEM]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user