1 #ifndef MSP_DEMOSCENE_LAUNCHER_H_
2 #define MSP_DEMOSCENE_LAUNCHER_H_
4 #include <msp/al/context.h>
5 #include <msp/al/device.h>
6 #include <msp/core/application.h>
7 #include <msp/graphics/display.h>
8 #include <msp/graphics/glcontext.h>
9 #include <msp/graphics/window.h>
10 #include <msp/input/keyboard.h>
11 #include <msp/io/base.h>
12 #include <msp/time/timedelta.h>
13 #include <msp/time/timestamp.h>
14 #include "resources.h"
27 Msp::Graphics::WindowOptions win_opts;
28 Msp::Graphics::WindowOptions fullscreen_opts;
30 std::string frame_dump_fn;
32 Msp::Time::TimeDelta seek;
36 Options(Msp::Graphics::Display &, int, char **);
38 static void parse_size(const std::string &, Msp::Graphics::WindowOptions &);
41 Msp::Graphics::Display display;
43 Msp::Graphics::Window window;
44 Msp::Graphics::GLContext gl_context;
45 Msp::Input::Keyboard keyboard;
46 Msp::AL::Device *al_device;
47 Msp::AL::Context *al_context;
49 LaunchScreen *launch_screen;
50 Msp::Time::TimeStamp timeout;
53 Msp::Time::TimeStamp next_frame;
54 Msp::IO::Base *frame_dump;
56 char *frame_dump_buffer;
59 LauncherBase(int, char **);
63 virtual Resources &get_resources() = 0;
64 virtual Demo *create_demo() = 0;
67 void tick_launch_screen();
68 virtual void tick_demo();
70 void start_demo(bool);
71 void key_press(unsigned);
73 virtual void exit(int) = 0;
77 class Launcher: public Msp::RegisteredApplication<T>, public LauncherBase
80 Launcher(int argc, char **argv): LauncherBase(argc, argv) { }
82 virtual int main() { start(); return Msp::Application::main(); }
83 virtual void tick() { LauncherBase::tick(); }
84 virtual void exit(int c) { Msp::Application::exit(c); }
87 } // namespace DemoScene