diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-10 19:12:31 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:55 +0200 |
commit | 38f14606c78c119d452f302f17329455e29a9a6f (patch) | |
tree | 03f6dfd9d3576e87260f7cb3bc436ad076b629c5 /src/engine/graphics | |
parent | 09848ad31af6a1c70d64fccee711e231afb5a77f (diff) |
refactor: rename game initializer & move input config
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; +}; |