mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-06-20 03:36:37 +02:00
remove simple scene and disable most stuff that used it. TODO: replace with organizer
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user