1 #include <msp/gl/blend.h>
2 #include <msp/gl/framebuffer.h>
3 #include <msp/gl/renderer.h>
4 #include <msp/strings/format.h>
5 #include "launchscreen.h"
10 LaunchScreen::LaunchScreen(Resources &resources):
11 font(resources.get_ui_font()),
12 tech(resources.get_ui_text_technique()),
13 countdown(font, &tech),
15 enter_prompt(font, &tech),
16 esc_prompt(font, &tech)
18 countdown.set_alignment(GL::Text::CENTER);
20 enter_prompt.set_alignment(GL::Text::CENTER);
21 enter_prompt.set_text("Press ENTER now to remain windowed");
23 esc_prompt.set_alignment(GL::Text::CENTER);
24 esc_prompt.set_text("Press ESC at any time to exit");
26 camera.set_orthographic(1920, 1080);
27 camera.set_depth_clip(-1, 1);
30 void LaunchScreen::set_countdown(unsigned c)
32 if(c!=countdown_value)
35 countdown.set_text(format("Going fullscreen in %d...", countdown_value));
39 void LaunchScreen::render()
41 GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT);
42 GL::Bind blend(GL::Blend::alpha());
43 GL::Renderer renderer(&camera);
44 renderer.transform(GL::Matrix().scale(48).translate(0, 1.2, 0));
45 countdown.render(renderer);
46 renderer.transform(GL::Matrix::translation(0, -1.2, 0));
47 enter_prompt.render(renderer);
48 renderer.transform(GL::Matrix::translation(0, -1.2, 0));
49 esc_prompt.render(renderer);
52 } // namespace DemoScene