aboutsummaryrefslogtreecommitdiff
path: root/src/engine/graphics/scene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/graphics/scene.cpp')
-rw-r--r--src/engine/graphics/scene.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/engine/graphics/scene.cpp b/src/engine/graphics/scene.cpp
new file mode 100644
index 0000000..3f63807
--- /dev/null
+++ b/src/engine/graphics/scene.cpp
@@ -0,0 +1,57 @@
+#include "scene.hpp"
+
+#include <fmt/core.h>
+#include <iostream>
+
+Scene::Scene(IMatrixFactory<std::string_view> 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<void()> &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();
+}
+*/