1 #ifndef MSP_GAME_DIRECTOR_H_
2 #define MSP_GAME_DIRECTOR_H_
7 #include <msp/datafile/collection.h>
8 #include <msp/time/timedelta.h>
9 #include <msp/time/timestamp.h>
10 #include "accessguard.h"
13 #include "eventsource.h"
22 using EventSource = Game::EventSource<Events::StageCreated, Events::StageActivated, Events::StageDeactivated>;
25 std::optional<AccessGuard> access_guard;
26 DataFile::Collection &resources;
28 EventSource event_source;
29 std::vector<std::unique_ptr<Stage>> stages;
30 Stage *active_stage = nullptr;
31 Time::TimeStamp last_tick;
32 Time::TimeDelta stepsize = Time::sec/60;
33 Time::TimeDelta backlog;
34 unsigned max_steps_per_frame = 5;
35 unsigned max_backlog_steps = 600;
38 Director(DataFile::Collection &);
41 DataFile::Collection &get_resources() const { return resources; }
42 EventBus &get_event_bus() { return event_bus; }
43 EventSource &get_event_source() { return event_source; }
44 const std::vector<std::unique_ptr<Stage>> &get_stages() const { return stages; }
46 Stage &create_stage();
47 void activate_stage(Stage &);
48 Stage *get_active_stage() const { return active_stage; }
53 } // namespace Msp::Game