summaryrefslogtreecommitdiff
path: root/applications/init/source/main.cpp
blob: ed0ef8e3fb89d6ee08f41710b1df9cd2f9b78e6b (plain) (blame)
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
#include <daguerre.hpp>

int main(int, char **) {

  auto hfb = daguerre::get_hilbert_framebuffer();
  daguerre::image<daguerre::rgb24> bim;

  std::FILE *burdon = std::fopen("/assets/burden.ppm", "r");
  daguerre::try_load_ppm(burdon, bim);
  std::fclose(burdon);

  unsigned width = bim.width < hfb.width ? bim.width : hfb.width;
  unsigned height = bim.height < hfb.height ? bim.height : hfb.height;
  unsigned x = (hfb.width - width) / 2;
  unsigned y = (hfb.height - height) / 2;

  while (1) {
    daguerre::copy_region<>(hfb, bim, 0, 0, x, y, width, height);
    while ((__euler_read_key_packet() & 0x0400ff) != 0x00005a)
      ;
    for (unsigned i = 0; i < bim.width * bim.height; ++i) {
      bim.buffer[i].r = 255 - bim.buffer[i].r;
      bim.buffer[i].g = 255 - bim.buffer[i].g;
      bim.buffer[i].b = 255 - bim.buffer[i].b;
    }
  }

}