summaryrefslogtreecommitdiff
path: root/c++/window/window.h
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2023-07-20 17:02:05 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2023-07-20 17:02:05 +0200
commitfac9e8bec1983fa9dff8f447fef106e427dfec26 (patch)
tree2221d4216873fa8250dd5ff45f00d0d6b46eab26 /c++/window/window.h
parent398164432abcf599eaa51ebc4088024b7f46b97f (diff)
c++: Renamed src to c++
Diffstat (limited to 'c++/window/window.h')
-rw-r--r--c++/window/window.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/c++/window/window.h b/c++/window/window.h
new file mode 100644
index 0000000..36786de
--- /dev/null
+++ b/c++/window/window.h
@@ -0,0 +1,79 @@
+#pragma once
+
+#include "video_mode.h"
+
+#include <forstio/async/async.h>
+#include <forstio/core/common.h>
+#include <forstio/codec/schema.h>
+
+#include <string_view>
+#include <variant>
+
+namespace saw {
+namespace gfx {
+namespace schema {
+using namespace saw::schema;
+using WindowResize = Struct<
+ Member<UInt32, "width">,
+ Member<UInt32, "height">
+>;
+using WindowEvents = Union<
+ Member<WindowResize, "resize">
+>;
+}
+
+template<typename T>
+class window;
+}
+}
+
+#include "linux_xcb.h"
+
+/**
+namespace saw {
+class window {
+public:
+ class event {
+ public:
+ struct resize {
+ size_t width;
+ size_t height;
+ };
+
+ struct keyboard {
+ uint32_t key;
+ uint32_t scan;
+ bool pressed;
+ bool repeat;
+ };
+
+ struct mouse {
+ uint16_t button_mask;
+ bool pressed;
+ uint32_t x;
+ uint32_t y;
+ };
+
+ struct mouse_move {
+ uint32_t x;
+ uint32_t y;
+ };
+ };
+
+ using variant_event = std::variant<event::resize, event::keyboard,
+ event::mouse, event::mouse_move>;
+
+ virtual ~window() = default;
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ virtual const video_mode &get_video_mode() const = 0;
+ virtual const std::string_view title() const = 0;
+
+ virtual void resize(size_t width, size_t height) = 0;
+
+ virtual conveyor<variant_event> on_event() = 0;
+};
+} // namespace saw
+*/