#include "scene.hpp" #include "engine/escape.hpp" #include "util/color.hpp" #include #include #include #include Scene::Scene(IMatrixFactory matrix_factory, std::shared_ptr cursor_controller, std::shared_ptr window) noexcept : _is_shown(false), _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 { if (_is_shown) { return; } fmt::print(ENABLE_ALT_BUFFER, fmt::arg("esc", ESC)); std::cout.flush(); _is_shown = true; } void Scene::leave() noexcept { if (!_is_shown) { return; } fmt::print(DISABLE_ALT_BUFFER, fmt::arg("esc", ESC)); std::cout.flush(); _is_shown = false; } auto Scene::get_matrix() const noexcept -> const std::shared_ptr> & { return _matrix; }