#include "stage.h"
+#include "root.h"
#include "system.h"
namespace Msp::Game {
-Stage::Stage():
- root(*this)
+Stage::Stage(DataFile::Collection &r):
+ resources(r),
+ event_source(event_bus),
+ root(std::make_unique<Root>(*this))
{ }
-// Hide ~unique_ptr<System> from the header
+// Hide unique_ptr destructors from the header
Stage::~Stage()
{ }
+void Stage::remove_system(System &s)
+{
+ erase_if(systems, [&s](auto &p){ return p.get()==&s; });
+}
+
void Stage::tick(Time::TimeDelta dt)
{
- for(const auto &s: systems)
- s->pre_tick();
for(const auto &s: systems)
s->tick(dt);
- for(const auto &s: systems)
- s->post_tick();
}
} // namespace Msp::Game