summaryrefslogtreecommitdiff
path: root/applications/goldman/source/main.cpp
blob: 2ade412a6f6195cdc90ca63352a578358240141c (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
#include <daguerre/framebuffer.hpp>
#include <daguerre/ppm.hpp>
#include "renderer.hpp"
#include "socket.hpp"
#include "input.hpp"
#include "main.hpp"

//TODO: handle errors

renderer *r;

int main() {

  euler::syscall::listener_handle listener;
  euler::syscall::create_socket_listener("hilbert.compositor", listener);

  r = new renderer(
    daguerre::get_hilbert_framebuffer(),
    *daguerre::try_load_ppm("/assets/background.ppm"),
    euler::syscall::encode_color(0x00, 0x00, 0x00),
    *daguerre::try_load_ppm("/assets/pointer.ppm"),
    euler::syscall::encode_color(0xff, 0x00, 0xff));

  euler::syscall::start_thread([]() { r->render_thread_main(); });
  euler::syscall::start_thread(input_thread_main);

  r->dispatch_render();

  euler::syscall::set_thread_name("socket listener thread");

  while (true) {
    euler::syscall::stream_handle socket;
    euler::syscall::accept_socket_connection(listener, socket);
    euler::syscall::start_thread(socket_thread_main, socket);
  }

}