From e6c3a80b01ffb52079783cddd9be6d392d0f7039 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 29 Jul 2024 19:59:52 -0400 Subject: redesign compositor protocol, start widget library --- applications/hello/makefile | 2 +- applications/hello/source/main.cpp | 43 ++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 26 deletions(-) (limited to 'applications/hello') diff --git a/applications/hello/makefile b/applications/hello/makefile index 5e12644..ea0b09a 100644 --- a/applications/hello/makefile +++ b/applications/hello/makefile @@ -6,7 +6,7 @@ build/%.cpp.o: source/%.cpp $(HILBERT_CC) -c $^ -o $@ build/hello.elf: $(SOURCES:%=build/%.o) - $(HILBERT_CC) $^ -ldaguerre -o $@ + $(HILBERT_CC) $^ -ldaguerre -lpake -o $@ clean: rm -rf build diff --git a/applications/hello/source/main.cpp b/applications/hello/source/main.cpp index 3f132c6..1f45407 100644 --- a/applications/hello/source/main.cpp +++ b/applications/hello/source/main.cpp @@ -1,37 +1,30 @@ -#include +#include #include +#include -template -void overlay(color_t &to, const bool &from, const color_t ¶m) { - if (from) - to = param; -} +daguerre::fixed_font *font; int main(int, char **) { - auto bg = euler::syscall::encode_color(0xaa, 0xaa, 0xaa); - auto fg = euler::syscall::encode_color(0x00, 0x00, 0x00); - - daguerre::image image(300, 200); - image.fill(bg); + font = new daguerre::fixed_font( + daguerre::try_load_psf("/assets/terminus-bold-18x10.psf").value()); - auto font = daguerre::try_load_psf("/assets/terminus-bold-18x10.psf"); - image.render_text(*font, fg, 10, 10, "Hello, world!", &overlay); + 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)); - euler::syscall::stream_handle s; - euler::syscall::connect_to_socket("hilbert.compositor", s); + pake::window w(300, 200, "Hello"); + w.set_root(std::unique_ptr(text)); + w.render_and_send_to_compositor(); + w.show(); - goldman::protocol::send_open_window(s, 300, 200); + //TODO: call event loop + euler::syscall::stream_handle h1, h2; + euler::syscall::create_private_socket(h1, h2); uint8_t byte; - euler::syscall::read_from_stream(s, 1, &byte); - - auto w = goldman::protocol::get_window_opened_body(s); - - goldman::protocol::send_update_window_region( - s, w, 0, 0, 300, 200, image.buffer, image.buffer_pitch); - - euler::syscall::read_from_stream(s, 1, &byte); - __builtin_unreachable(); + while (1) + euler::syscall::read_from_stream(h1, 1, &byte); } -- cgit v1.2.3