diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-07 19:45:17 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:01 +0200 |
commit | 8805b1fe27344e8086cebabf869b7a02d2376f05 (patch) | |
tree | a90a2e2dda1bcb98fb4de5cd983138e5441c2222 /src/engine/graphics/scene.hpp | |
parent | f778317bae709f397345a2d5e04e23864c6391b3 (diff) |
refactor: decouple statusline from scene & cursor controller
Might be slightly slower than previously though...
Diffstat (limited to 'src/engine/graphics/scene.hpp')
-rw-r--r-- | src/engine/graphics/scene.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/engine/graphics/scene.hpp b/src/engine/graphics/scene.hpp index 60b541a..c2b11e8 100644 --- a/src/engine/graphics/scene.hpp +++ b/src/engine/graphics/scene.hpp @@ -1,14 +1,19 @@ #pragma once +#include "interfaces/component.hpp" #include "interfaces/cursor.hpp" #include "interfaces/matrix.hpp" #include "interfaces/scene.hpp" +#include "engine/data/vector2.hpp" + #include <fmt/core.h> #include <memory> #include <string_view> #include <termios.h> +#include <utility> +#include <vector> constexpr fmt::string_view ENABLE_ALT_BUFFER = "{esc}[?1049h"; constexpr fmt::string_view DISABLE_ALT_BUFFER = "{esc}[?1049l"; @@ -29,10 +34,19 @@ public: [[nodiscard]] auto get_matrix() const noexcept -> const std::shared_ptr<IMatrix<MatrixElement>> & override; + void register_component( + const std::shared_ptr<IComponent> &component, + const Vector2 &position) noexcept override; + + [[nodiscard]] auto get_components() const noexcept + -> std::vector<std::pair<std::shared_ptr<IComponent>, Vector2>> override; + private: std::shared_ptr<IMatrix<MatrixElement>> _matrix; std::shared_ptr<ICursorController> _cursor_controller; bool _is_shown; std::shared_ptr<termios> _original_termios = nullptr; + + std::vector<std::pair<std::shared_ptr<IComponent>, Vector2>> _components; }; |