summaryrefslogtreecommitdiff
path: root/applications/init/main.cpp
blob: a3f75e482374311c74cbad80d779051671316ee5 (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
#include <mercury/syscall.hpp>

using mercury::syscall::encoded_color;
using mercury::syscall::color;

encoded_color *fb;
uint32_t fb_width;
uint32_t fb_height;
uint32_t fb_pitch;

int main(int, char **) {

  mercury::syscall::get_framebuffer(fb, fb_width, fb_height, fb_pitch);
  for (uint32_t y = 0; y < fb_height; ++y)
    for (uint32_t x = 0; x < fb_width; ++x) {
       color c = {
        .r = 0,
        .g = (uint8_t)(y * 255 / fb_height),
        .b = (uint8_t)(x * 255 / fb_width)
      };
      fb[y * fb_pitch + x] = mercury::syscall::encode_color(c);
    }
  mercury::syscall::draw_framebuffer();

  return 1 / 0;
}