This is much more flexible than exposing everything so Demo can add them.
void Demo::add_stage(const std::string &name, Stage &stage)
{
things[name] = &stage;
- things[name+".camera"] = static_cast<GL::Placeable *>(&stage.get_camera());
+ stage.add_things(things, name+".");
}
void Demo::set_fixed_framerate(float fps)
};
public:
+ typedef std::map<std::string, Msp::Variant> ThingMap;
+
sigc::signal<void> signal_finished;
protected:
Msp::Time::TimeStamp last_tick;
Msp::Time::TimeStamp next_frame;
- std::map<std::string, Msp::Variant> things;
+ ThingMap things;
Demo(Msp::Graphics::Window &, Msp::Graphics::GLContext &, Msp::DataFile::Collection &);
public:
delete pipeline;
}
+void Stage::add_things(Demo::ThingMap &things, const string &prefix)
+{
+ things[prefix+"camera"] = static_cast<GL::Placeable *>(&camera);
+}
+
void Stage::add_postprocessor(GL::PostProcessor &pp)
{
pipeline->add_postprocessor(pp);
#include <msp/gl/camera.h>
#include <msp/gl/pipeline.h>
#include "action.h"
+#include "demo.h"
class Stage
{
Stage();
~Stage();
+ virtual void add_things(Demo::ThingMap &, const std::string &);
void add_postprocessor(Msp::GL::PostProcessor &);
void set_camera(const Msp::GL::Camera &);
Msp::GL::Camera &get_camera() { return camera; }