summaryrefslogtreecommitdiff
path: root/applications/hello/source/main.cpp
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-07-29 11:27:22 -0400
committerBenji Dial <benji@benjidial.net>2024-07-29 11:27:22 -0400
commitbe691582ee12613278af24cb5a824eeb357f6324 (patch)
tree5982ca3aad5257f515c93f62735ff3d630aa3ab3 /applications/hello/source/main.cpp
parent3636fd21e079c47bd8d62e773e178f68fe9c2052 (diff)
downloadhilbert-os-be691582ee12613278af24cb5a824eeb357f6324.tar.gz
some work on compositor
Diffstat (limited to 'applications/hello/source/main.cpp')
-rw-r--r--applications/hello/source/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/applications/hello/source/main.cpp b/applications/hello/source/main.cpp
new file mode 100644
index 0000000..3f132c6
--- /dev/null
+++ b/applications/hello/source/main.cpp
@@ -0,0 +1,37 @@
+#include <goldman/protocol.hpp>
+#include <daguerre/psf.hpp>
+
+template <class color_t>
+void overlay(color_t &to, const bool &from, const color_t &param) {
+ if (from)
+ to = param;
+}
+
+int main(int, char **) {
+
+ auto bg = euler::syscall::encode_color(0xaa, 0xaa, 0xaa);
+ auto fg = euler::syscall::encode_color(0x00, 0x00, 0x00);
+
+ daguerre::image<daguerre::hilbert_color> image(300, 200);
+ image.fill(bg);
+
+ auto font = daguerre::try_load_psf("/assets/terminus-bold-18x10.psf");
+ image.render_text(*font, fg, 10, 10, "Hello, world!", &overlay);
+
+ euler::syscall::stream_handle s;
+ euler::syscall::connect_to_socket("hilbert.compositor", s);
+
+ goldman::protocol::send_open_window(s, 300, 200);
+
+ 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();
+
+}