diff options
author | Claudius Holeksa <mail@keldu.de> | 2023-05-22 00:37:33 +0200 |
---|---|---|
committer | Claudius Holeksa <mail@keldu.de> | 2023-05-22 00:37:33 +0200 |
commit | 7f0440cc25fc3ebc711df9fb708a5bffe53bf784 (patch) | |
tree | 8de4c18388b258f7af3b268b534723da48ce1616 /src/window/window.h | |
parent | a93b825968d6da81200bbda00ece1371f0f7945e (diff) |
c++: Initial setup for regular window creation
Diffstat (limited to 'src/window/window.h')
-rw-r--r-- | src/window/window.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/window/window.h b/src/window/window.h new file mode 100644 index 0000000..216c866 --- /dev/null +++ b/src/window/window.h @@ -0,0 +1,57 @@ +#pragma once + +#include <forstio/async/async.h> +#include <forstio/common.h> + +#include <string_view> +#include <variant> + +#include "video_mode.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 &videoMode() 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 |