#include "scene.hpp" #include #include Scene::Scene(IMatrixFactory matrix_factory) : _is_shown(false), _matrix_factory(std::move(matrix_factory)) { } void Scene::enter() { if (_is_shown) { return; } fmt::print(ENABLE_ALT_BUFFER, fmt::arg("esc", ESC)); std::cout.flush(); _is_shown = true; } void Scene::leave() { if (!_is_shown) { return; } fmt::print(DISABLE_ALT_BUFFER, fmt::arg("esc", ESC)); std::cout.flush(); _is_shown = false; } /* void do_in_statusbar(const std::function &routine) { const auto prev_pos = Cursor::where(); const auto window_size = Window::size(); Cursor::hide(); Cursor::move_to(Vector2({1, window_size.height()})); std::cout << fmt::format(EscapeSequences::ERASE_LINE, fmt::arg("esc", ESC)); std::cout.flush(); routine(); Cursor::move_to(prev_pos); Cursor::show(); } */