]> git.tdb.fi Git - libs/game.git/blob - source/game/stage.cpp
0eb4238fcff375709404b00e52061730e0694cae
[libs/game.git] / source / game / stage.cpp
1 #include "stage.h"
2 #include "root.h"
3 #include "system.h"
4
5 namespace Msp::Game {
6
7 Stage::Stage(DataFile::Collection &r):
8         resources(r),
9         event_source(event_bus),
10         root(std::make_unique<Root>(*this))
11 { }
12
13 // Hide unique_ptr destructors from the header
14 Stage::~Stage()
15 { }
16
17 void Stage::remove_system(System &s)
18 {
19         erase_if(systems, [&s](auto &p){ return p.get()==&s; });
20 }
21
22 void Stage::tick(Time::TimeDelta dt)
23 {
24         for(const auto &s: systems)
25                 s->tick(dt);
26 }
27
28 } // namespace Msp::Game