diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-19 13:28:29 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:56 +0200 |
commit | 3dbf3b68c484704aafcda9fd05ae88a0337956ef (patch) | |
tree | b7a2d45811c0ed5e336f87c23369f3929322b0cc /src/engine/graphics | |
parent | 55c93fe609888be73677317978959040cf35b2ff (diff) |
feat: add inserting cells
Diffstat (limited to 'src/engine/graphics')
-rw-r--r-- | src/engine/graphics/scene.cpp | 8 | ||||
-rw-r--r-- | src/engine/graphics/scene.hpp | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/engine/graphics/scene.cpp b/src/engine/graphics/scene.cpp index 660e3ca..476b966 100644 --- a/src/engine/graphics/scene.cpp +++ b/src/engine/graphics/scene.cpp @@ -12,10 +12,11 @@ Scene::Scene(IMatrixFactory<std::string_view> matrix_factory, std::shared_ptr<ICursorController> cursor_controller, std::shared_ptr<IWindow> window) noexcept : _is_shown(false), - _matrix_factory(matrix_factory), + _matrix(matrix_factory(window->size() - Bounds({.width = 0U, .height = 1U}))), _cursor_controller(std::move(cursor_controller)), _window(std::move(window)) { + _matrix->fill(" "); } void Scene::enter() noexcept @@ -62,3 +63,8 @@ void Scene::write_status(const std::string_view &str) noexcept _cursor_controller->move_to(previous_position); } + +const std::shared_ptr<IMatrix<std::string_view>> &Scene::get_matrix() const noexcept +{ + return _matrix; +} diff --git a/src/engine/graphics/scene.hpp b/src/engine/graphics/scene.hpp index 22a96a4..1f1c51c 100644 --- a/src/engine/graphics/scene.hpp +++ b/src/engine/graphics/scene.hpp @@ -29,11 +29,13 @@ public: void write_status(const std::string_view &str) noexcept override; + [[nodiscard]] const std::shared_ptr<IMatrix<std::string_view>> & + get_matrix() const noexcept override; + private: bool _is_shown; - IMatrixFactory<std::string_view> _matrix_factory; - + std::shared_ptr<IMatrix<std::string_view>> _matrix; std::shared_ptr<ICursorController> _cursor_controller; std::shared_ptr<IWindow> _window; }; |