aboutsummaryrefslogtreecommitdiff
path: root/src/engine/graphics/scene.hpp
blob: 1f1c51c3e0227480421b8021d5ad2365c931da93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "interfaces/cursor.hpp"
#include "interfaces/matrix.hpp"
#include "interfaces/scene.hpp"
#include "interfaces/window.hpp"

#include <fmt/core.h>
#include <memory>
#include <string_view>

constexpr fmt::string_view ENABLE_ALT_BUFFER = "{esc}[?1049h";
constexpr fmt::string_view DISABLE_ALT_BUFFER = "{esc}[?1049l";

constexpr fmt::string_view ERASE_ENTIRE_LINE = "{esc}[2K";

constexpr uint32_t STATUSBAR_COLOR = 0x1A1A1AU;

class Scene : public IScene
{
public:
	explicit Scene(IMatrixFactory<std::string_view> matrix_factory,
				   std::shared_ptr<ICursorController> cursor_controller,
				   std::shared_ptr<IWindow> window) noexcept;

	void enter() noexcept override;

	void leave() noexcept override;

	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;

	std::shared_ptr<IMatrix<std::string_view>> _matrix;
	std::shared_ptr<ICursorController> _cursor_controller;
	std::shared_ptr<IWindow> _window;
};