1 #ifndef MSP_DEMOSCENE_DEMO_H_
2 #define MSP_DEMOSCENE_DEMO_H_
6 #include <sigc++/signal.h>
7 #include <msp/al/sounddecoder.h>
8 #include <msp/al/source.h>
9 #include <msp/al/streamer.h>
10 #include <msp/datafile/collection.h>
11 #include <msp/gl/animationplayer.h>
12 #include <msp/gl/windowview.h>
14 #include "sequencer.h"
21 class AnimationAction: public Action
24 Msp::GL::AnimationPlayer &player;
27 AnimationAction(Msp::GL::AnimationPlayer &);
29 virtual void validate() const { }
31 virtual void tick(float, float);
35 sigc::signal<void> signal_finished;
39 Msp::DataFile::Collection &resources;
40 Msp::GL::WindowView view;
41 Msp::GL::AnimationPlayer anim_player;
42 AnimationAction anim_action;
43 Msp::AL::Source *music_source;
44 Msp::AL::Streamer *streamer;
45 Msp::IO::Seekable *music_io;
46 Msp::AL::SoundDecoder *music_decoder;
47 Msp::Time::TimeDelta frame_interval;
48 Msp::Time::TimeStamp last_tick;
49 Msp::Time::TimeStamp next_frame;
51 std::map<std::string, Msp::Variant> things;
53 Demo(Msp::Graphics::Window &, Msp::Graphics::GLContext &, Msp::DataFile::Collection &);
57 Msp::DataFile::Collection &get_resources() const { return resources; }
58 Msp::GL::AnimationPlayer &get_animation_player() { return anim_player; }
61 void add_stage(const std::string &, Stage &);
64 T &get_thing(const std::string &);
66 void set_fixed_framerate(float);
67 const Msp::Time::TimeStamp &get_next_frame_time() const { return next_frame; }
69 void play_music(const std::string &);
71 void seek(const Msp::Time::TimeDelta &);
75 T &Demo::get_thing(const std::string &name)
77 return *get_item(things, name).value<T *>();