diff options
Diffstat (limited to 'src/engine/graphics')
-rw-r--r-- | src/engine/graphics/window.cpp | 13 | ||||
-rw-r--r-- | src/engine/graphics/window.hpp | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/engine/graphics/window.cpp b/src/engine/graphics/window.cpp new file mode 100644 index 0000000..d6bae0c --- /dev/null +++ b/src/engine/graphics/window.cpp @@ -0,0 +1,13 @@ +#include "window.hpp" + +#include <sys/ioctl.h> + +Bounds Window::size() const noexcept +{ + winsize window_size = {}; + + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + ioctl(0, TIOCGWINSZ, &window_size); + + return Bounds({window_size.ws_col, window_size.ws_row}); +} diff --git a/src/engine/graphics/window.hpp b/src/engine/graphics/window.hpp new file mode 100644 index 0000000..c9a9c70 --- /dev/null +++ b/src/engine/graphics/window.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "DI/auto_wirable.hpp" +#include "interfaces/window.hpp" + +#include "engine/data/bounds.hpp" + +class Window : public IWindow, public AutoWirable<IWindow, Window> +{ +public: + Window() noexcept = default; + + [[nodiscard]] Bounds size() const noexcept override; +}; |