remove simple scene and disable most stuff that used it. TODO: replace with organizer

This commit is contained in:
2021-12-11 23:21:09 +01:00
parent b0e065e2ef
commit 0ad504e5d4
18 changed files with 40 additions and 351 deletions

View File

@ -3,6 +3,7 @@
#include <mm/engine_fwd.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entity/organizer.hpp>
#include <mm/systems/simple_velocity_system2d.hpp>
@ -10,8 +11,15 @@ TEST(simple_velocity_2d, basic_run) {
MM::Scene scene;
// setup v system
MM::AddSystemToScene(scene, MM::Systems::SimpleVelocity);
auto& org = scene.set<entt::organizer>();
org.emplace<&MM::Systems::simple_velocity>("simple_velocity");
auto graph = org.graph();
// setup delta
auto& time_ctx = scene.ctx_or_set<MM::Components::TimeDelta>(1.f/60.f, 1.f);
time_ctx.tickDelta = 1.f/60.f * time_ctx.deltaFactor;
// setup test entity
auto e = scene.create();
auto& t = scene.emplace<MM::Components::Transform2D>(e);
auto& v = scene.emplace<MM::Components::Velocity2D>(e);
@ -21,9 +29,10 @@ TEST(simple_velocity_2d, basic_run) {
v.velocity = { 1.f, 1.f };
v.rotation = 0.f;
::MM::EachSystemInScene(scene, [&](::MM::Scene& s, ::MM::System& fn) {
fn(s, 1.f/60.f);
});
// run all systems
for (auto&& vert : graph) {
vert.callback()(vert.data(), scene);
}
ASSERT_EQ(t.position.x, 1.f * 1.f/60.f);
}