X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgame%2Fstage.h;h=a046947f57ad7d0f49e43621f003ac739a4d5713;hb=c462430faa39c68edfc28446260c86ec100e3424;hp=d7793e22f60ec21fd52acab1b8af9aafbe2f4d94;hpb=c3ac50ad3e79b26d1d99bd222a7e43adb86c2c1e;p=libs%2Fgame.git diff --git a/source/game/stage.h b/source/game/stage.h index d7793e2..a046947 100644 --- a/source/game/stage.h +++ b/source/game/stage.h @@ -2,6 +2,7 @@ #define MSP_GAME_STAGE_H_ #include +#include #include #include "eventbus.h" #include "events.h" @@ -10,6 +11,7 @@ namespace Msp::Game { +class Camera; class Root; class System; @@ -17,21 +19,25 @@ class Stage { public: using EventSource = Game::EventSource; + Events::ComponentCreated, Events::ComponentDestroyed, Events::CameraChanged>; private: + DataFile::Collection &resources; PoolPool pools; EventBus event_bus; EventSource event_source; + EventObserver event_observer; /* Use unique_ptr because there's only one root per stage so it's pointless to put it in a pool. */ std::unique_ptr root; std::vector> systems; + Handle active_camera; public: - Stage(); + Stage(DataFile::Collection &); ~Stage(); + DataFile::Collection &get_resources() const { return resources; } PoolPool &get_pools() { return pools; } EventBus &get_event_bus() { return event_bus; } EventSource &get_event_source() { return event_source; } @@ -43,11 +49,20 @@ public: template T &add_system(Args &&...); + void remove_system(System &); const std::vector> &get_systems() const { return systems; } template T *get_system() const; + void set_active_camera(Handle); + Handle get_active_camera() const { return active_camera; } + + void synthesize_initial_events(EventObserver &); +private: + void synthesize_initial_events(Handle, EventObserver &); + +public: void tick(Time::TimeDelta); };