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;
29 Msp::Graphics::GLOptions gl_opts;
31 std::string frame_dump_fn;
33 Msp::Time::TimeDelta seek;
37 Options(Msp::Graphics::Display &, int, char **);
39 static void parse_size(const std::string &, Msp::Graphics::WindowOptions &);
42 Msp::Graphics::Display display;
44 Msp::Graphics::Window window;
45 Msp::Graphics::GLContext gl_context;
46 Msp::Input::Keyboard keyboard;
47 Msp::AL::Device *al_device;
48 Msp::AL::Context *al_context;
50 LaunchScreen *launch_screen;
51 Msp::Time::TimeStamp timeout;
54 Msp::Time::TimeStamp next_frame;
55 Msp::IO::Base *frame_dump;
57 char *frame_dump_buffer;
60 LauncherBase(int, char **);
64 virtual Resources &get_resources() = 0;
65 virtual Demo *create_demo() = 0;
68 void tick_launch_screen();
69 virtual void tick_demo();
71 void start_demo(bool);
72 void key_press(unsigned);
74 virtual void exit(int) = 0;
78 class Launcher: public Msp::RegisteredApplication<T>, public LauncherBase
81 Launcher(int argc, char **argv): LauncherBase(argc, argv) { }
83 virtual int main() { start(); return Msp::Application::main(); }
84 virtual void tick() { LauncherBase::tick(); }
85 virtual void exit(int c) { Msp::Application::exit(c); }
88 } // namespace DemoScene