X-Git-Url: http://git.tdb.fi/?p=libs%2Fdemoscene.git;a=blobdiff_plain;f=source%2Fdemo.h;h=77eb671601fc52f79386b341acf06777d7e1c07a;hp=2f40cf8df577e4f8796a1f53401d46de9ae7cd2e;hb=2a957e891f86cc692ddbb80f71b1478ea03d5a4f;hpb=da21a5a971c2dfa3fdd729c4f799908253bb3873 diff --git a/source/demo.h b/source/demo.h index 2f40cf8..77eb671 100644 --- a/source/demo.h +++ b/source/demo.h @@ -1,6 +1,8 @@ #ifndef MSP_DEMOSCENE_DEMO_H_ #define MSP_DEMOSCENE_DEMO_H_ +#include +#include #include #include #include @@ -26,10 +28,15 @@ protected: Msp::Time::TimeStamp last_tick; Msp::Time::TimeStamp next_frame; + std::map things; + Demo(Msp::Graphics::Window &, Msp::Graphics::GLContext &, Msp::DataFile::Collection &); public: virtual ~Demo(); + template + T &get_thing(const std::string &); + void set_fixed_framerate(float); const Msp::Time::TimeStamp &get_next_frame_time() const { return next_frame; } void enable_music(); @@ -38,5 +45,10 @@ public: void seek(const Msp::Time::TimeDelta &); }; +template +T &Demo::get_thing(const std::string &name) +{ + return *get_item(things, name).value(); +} #endif