]> git.tdb.fi Git - libs/demoscene.git/blob - source/demo.h
Initial files lifted from the Skrolliparty 2 demo
[libs/demoscene.git] / source / demo.h
1 #ifndef MSP_DEMOSCENE_DEMO_H_
2 #define MSP_DEMOSCENE_DEMO_H_
3
4 #include <sigc++/signal.h>
5 #include <msp/al/sounddecoder.h>
6 #include <msp/al/source.h>
7 #include <msp/al/streamer.h>
8 #include <msp/datafile/collection.h>
9 #include <msp/gl/windowview.h>
10 #include "sequencer.h"
11
12 class Demo
13 {
14 public:
15         sigc::signal<void> signal_finished;
16
17 protected:
18         Sequencer sequencer;
19         Msp::DataFile::Collection &resources;
20         Msp::GL::WindowView view;
21         Msp::AL::Source *music_source;
22         Msp::AL::Streamer *streamer;
23         Msp::IO::Seekable *music_io;
24         Msp::AL::SoundDecoder *music_decoder;
25         Msp::Time::TimeDelta frame_interval;
26         Msp::Time::TimeStamp last_tick;
27         Msp::Time::TimeStamp next_frame;
28
29         Demo(Msp::Graphics::Window &, Msp::Graphics::GLContext &, Msp::DataFile::Collection &);
30 public:
31         virtual ~Demo();
32
33         void set_fixed_framerate(float);
34         const Msp::Time::TimeStamp &get_next_frame_time() const { return next_frame; }
35         void enable_music();
36         void play_music(const std::string &);
37         virtual void tick();
38         void seek(const Msp::Time::TimeDelta &);
39 };
40
41
42 #endif