-
Notifications
You must be signed in to change notification settings - Fork 0
/
contest.cpp
52 lines (41 loc) · 1.18 KB
/
contest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "src/system.hpp"
#include "src/pix/pixel_console.hpp"
#include <gl/color.hpp>
#include <gl/functions.hpp>
#include <gl/gl.hpp>
#include <gl/program.hpp>
#include <gl/texture.hpp>
#include <pix/font.hpp>
int main()
{
namespace gl = gl_wrap;
#ifdef RASPBERRY_PI
auto system = create_pi_system();
#else
auto system = create_sdl_system();
#endif
Settings settings;
auto window = system->init_screen(settings);
system->init_input(settings);
gl::Color bg{0xffff00ff};
PixConsole con{120, 34};
con.set_tile_size(38, 38);
con.fill(0xffffffff, 0x004040ff);
auto image = pix::load_png("data/ball.png");
con.set_tile_image('i', image);
con.set_tile_image('H', image);
// con.text(2, 2, "ZweZxywXVwooPO");
con.text(2, 3, "Hello citizens of the earth! This console is fast!",
0x8080ffff, 0x0000ffff);
con.flush();
while (true) {
//con.scramble();
auto event = system->poll_events();
if (std::holds_alternative<QuitEvent>(event)) { break; }
glBindFramebuffer(GL_FRAMEBUFFER, 0);
gl::clearColor(bg);
glClear(GL_COLOR_BUFFER_BIT);
con.render();
window->swap();
}
}