X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgame%2Fstage.h;h=283dc81c0747776875cfed9d0048aa720b1bfbba;hb=bdcd6a6268dec57ad352e30d86734b28a885a017;hp=d2d05dd986a1c2f21a1f9f59f9a1116d7b330448;hpb=38ffef0320a70909f3e13e9681e4720352e440aa;p=libs%2Fgame.git diff --git a/source/game/stage.h b/source/game/stage.h index d2d05dd..283dc81 100644 --- a/source/game/stage.h +++ b/source/game/stage.h @@ -8,9 +8,11 @@ #include "events.h" #include "eventsource.h" #include "handle.h" +#include "reflection.h" namespace Msp::Game { +class Camera; class Root; class System; @@ -18,22 +20,26 @@ class Stage { public: using EventSource = Game::EventSource; + Events::ComponentCreated, Events::ComponentDestroyed, Events::CameraChanged>; private: + Reflection::Reflector &reflector; 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(DataFile::Collection &); + Stage(Reflection::Reflector &, DataFile::Collection &); ~Stage(); + Reflection::Reflector &get_reflector() const { return reflector; } DataFile::Collection &get_resources() const { return resources; } PoolPool &get_pools() { return pools; } EventBus &get_event_bus() { return event_bus; } @@ -52,6 +58,14 @@ public: 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); };