aboutsummaryrefslogtreecommitdiff
path: root/src/game/statusline.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-23 19:41:31 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:57 +0200
commit486ca3846b46dc229e5807968578809766ec1991 (patch)
tree65a4b7a746d6305666af06f8a1975c76244085a7 /src/game/statusline.hpp
parentb8e86ce397dc07320c02f6a5f592c7c6a4421c86 (diff)
feat: implement generations & multithreading
Diffstat (limited to 'src/game/statusline.hpp')
-rw-r--r--src/game/statusline.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/game/statusline.hpp b/src/game/statusline.hpp
new file mode 100644
index 0000000..7db1e0b
--- /dev/null
+++ b/src/game/statusline.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "interfaces/cursor.hpp"
+#include "interfaces/statusline.hpp"
+#include "interfaces/window.hpp"
+
+#include "engine/data/vector2.hpp"
+
+#include <cstdint>
+#include <fmt/core.h>
+#include <memory>
+#include <string_view>
+#include <unordered_map>
+
+constexpr uint32_t STATUSBAR_COLOR = 0x1A1A1AU;
+
+class StatusLine : public IStatusLine
+{
+public:
+ StatusLine(std::shared_ptr<ICursorController> cursor_controller,
+ std::shared_ptr<IWindow> window) noexcept;
+
+ void initialize_background() noexcept override;
+
+ void set_status(StatusLineSection section,
+ const std::string_view &str) noexcept override;
+
+private:
+ std::unordered_map<StatusLineSection, uint32_t> _sections_lengths;
+
+ std::shared_ptr<ICursorController> _cursor_controller;
+ std::shared_ptr<IWindow> _window;
+
+ Vector2 _move_to_statusline(int32_t x) noexcept;
+
+ void _move_back(Vector2 previous_position) noexcept;
+
+ int32_t _get_section_start_x(StatusLineSection section) const noexcept;
+
+ void _clear_section(StatusLineSection section) noexcept;
+};