diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-01-18 22:56:18 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-01-18 22:56:18 +0100 |
| commit | 7c0d53684c638af98bece65edc7e744cae80806c (patch) | |
| tree | 5736e296cbc15832b565f0143e059fa21bf79f7b /include/window.hpp | |
| parent | 25125b2e23c02199bdefb3a638584465229fd833 (diff) | |
Event logic & handle resize & close for xcb windows
Diffstat (limited to 'include/window.hpp')
| -rw-r--r-- | include/window.hpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/include/window.hpp b/include/window.hpp index 3298d36..dae4f00 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -2,6 +2,7 @@ #define __WINDOW_HPP_ #include <cstdint> +#include <vector> #include "defines.hpp" @@ -9,23 +10,20 @@ class vkrenderer; #if defined(LINUX) #include <xcb/xcb.h> +#elif defined(WINDOWS) +#include <Windows.h> +#endif -class window { - public: - window(uint32_t width, uint32_t height); - - void poll_events(); - - xcb_connection_t* connection; - xcb_window_t win; - - uint32_t width; - uint32_t height; +enum EVENT_TYPES: int32_t { + QUIT, + RESIZE, +}; - bool isOpen; +struct event { + uint32_t width; + uint32_t height; + EVENT_TYPES type; }; -#elif defined(WINDOWS) -#include <Windows.h> class window { public: @@ -33,18 +31,25 @@ class window { void poll_events(); + +#if defined(WINDOWS) LRESULT message_handler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam); static LRESULT CALLBACK window_procedure(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam); HWND win_handle; - vkrenderer* renderer = nullptr; +#elif defined(LINUX) + xcb_connection_t* connection; + xcb_window_t win; + xcb_atom_t win_delete_atom; +#endif + + std::vector<event> events; uint32_t width; uint32_t height; bool isOpen; }; -#endif #endif // !__WINDOW_HPP_ |
