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"
9 LaunchScreen::LaunchScreen(DataFile::Collection &resources):
10 font(resources.get<GL::Font>("ikarius-48.font")),
11 tech(resources.get<GL::Technique>("basic_text.tech")),
12 countdown(font, &tech),
14 enter_prompt(font, &tech),
15 esc_prompt(font, &tech)
17 countdown.set_alignment(GL::Text::CENTER);
19 enter_prompt.set_alignment(GL::Text::CENTER);
20 enter_prompt.set_text("Press ENTER now to remain windowed");
22 esc_prompt.set_alignment(GL::Text::CENTER);
23 esc_prompt.set_text("Press ESC at any time to exit");
25 camera.set_orthographic(1920, 1080);
26 camera.set_depth_clip(-1, 1);
29 void LaunchScreen::set_countdown(unsigned c)
31 if(c!=countdown_value)
34 countdown.set_text(format("Going fullscreen in %d...", countdown_value));
38 void LaunchScreen::render()
40 GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT);
41 GL::Bind blend(GL::Blend::alpha());
42 GL::Renderer renderer(&camera);
43 renderer.transform(GL::Matrix().scale(48).translate(0, 1.2, 0));
44 countdown.render(renderer);
45 renderer.transform(GL::Matrix::translation(0, -1.2, 0));
46 enter_prompt.render(renderer);
47 renderer.transform(GL::Matrix::translation(0, -1.2, 0));
48 esc_prompt.render(renderer);