summaryrefslogtreecommitdiff
path: root/applications/hello/source/main.cpp
blob: b2977211dcdfdec79277f0d41abaeff6b7770a87 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <pake/widgets/fixed-text.hpp>
#include <daguerre/psf.hpp>
#include <pake/window.hpp>

daguerre::fixed_font<bool> *font;

int main(int, char **) {

  font = new daguerre::fixed_font<bool>(
    daguerre::try_load_psf("/assets/terminus/10x18-bold.psf").value());

  pake::widgets::fixed_text *text =
    new pake::widgets::fixed_text("Hello, world!", font,
      euler::syscall::encode_color(0xaa, 0xaa, 0xaa),
      euler::syscall::encode_color(0x00, 0x00, 0x00),
      pake::halign::center, pake::valign::center);

  pake::window w(300, 200, "Hello");
  w.set_root(std::unique_ptr<pake::widget>(text));
  w.render_and_send_to_compositor();
  w.show();

  pake::widgets::fixed_text *text2 =
    new pake::widgets::fixed_text("H!", font,
      euler::syscall::encode_color(0xaa, 0xaa, 0xaa),
      euler::syscall::encode_color(0x00, 0x00, 0x00),
      pake::halign::center, pake::valign::center);

  pake::window w2(100, 50, "Hello 2");
  w2.set_root(std::unique_ptr<pake::widget>(text2));
  w2.render_and_send_to_compositor();
  w2.show();

  //TODO: call event loop

  euler::syscall::stream_handle h1, h2;
  euler::syscall::create_private_socket(h1, h2);
  uint8_t byte;
  while (1)
    euler::syscall::read_from_stream(h1, 1, &byte);

}