summaryrefslogtreecommitdiff
path: root/applications/goldman/source/renderer.hpp
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/goldman/source/renderer.hpp
parent3636fd21e079c47bd8d62e773e178f68fe9c2052 (diff)
downloadhilbert-os-be691582ee12613278af24cb5a824eeb357f6324.tar.gz
some work on compositor
Diffstat (limited to 'applications/goldman/source/renderer.hpp')
-rw-r--r--applications/goldman/source/renderer.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/applications/goldman/source/renderer.hpp b/applications/goldman/source/renderer.hpp
new file mode 100644
index 0000000..14a5964
--- /dev/null
+++ b/applications/goldman/source/renderer.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include <daguerre/image.hpp>
+#include "window.hpp"
+#include <mutex>
+#include <list>
+
+class renderer {
+
+ daguerre::image<daguerre::hilbert_color> framebuffer;
+ daguerre::image<daguerre::hilbert_color> double_buffer;
+
+ daguerre::image<daguerre::hilbert_color> background;
+ daguerre::image<daguerre::hilbert_color> cursor;
+ daguerre::hilbert_color cursor_background;
+
+ int cursor_x;
+ int cursor_y;
+
+ //bottom to top
+ std::list<const window *> windows;
+
+ std::mutex mut;
+
+ euler::syscall::stream_handle
+ dispatcher_handle_1, dispatcher_handle_2;
+
+ void do_render();
+
+public:
+ renderer(
+ daguerre::image<daguerre::hilbert_color> &&framebuffer,
+ daguerre::image<daguerre::hilbert_color> &&background,
+ daguerre::hilbert_color background_color,
+ daguerre::image<daguerre::hilbert_color> &&cursor,
+ daguerre::hilbert_color cursor_background);
+
+ inline ~renderer() {
+ euler::syscall::close_stream(dispatcher_handle_1);
+ euler::syscall::close_stream(dispatcher_handle_2);
+ }
+
+ renderer(const renderer &) = delete;
+ renderer &operator =(const renderer &) = delete;
+
+ [[noreturn]] void render_thread_main();
+
+ inline void lock() { mut.lock(); }
+ inline void unlock() { mut.unlock(); }
+
+ inline void dispatch_render() {
+ uint8_t byte = 0;
+ euler::syscall::write_to_stream(dispatcher_handle_1, 1, &byte);
+ }
+
+ void bump_cursor(int x_offset, int y_offset);
+
+ void add_window(const window *w);
+ void remove_window(const window *w);
+
+};