From 486ca3846b46dc229e5807968578809766ec1991 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 23 Mar 2022 19:41:31 +0100 Subject: feat: implement generations & multithreading --- src/game/statusline.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/game/statusline.hpp (limited to 'src/game/statusline.hpp') 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 +#include +#include +#include +#include + +constexpr uint32_t STATUSBAR_COLOR = 0x1A1A1AU; + +class StatusLine : public IStatusLine +{ +public: + StatusLine(std::shared_ptr cursor_controller, + std::shared_ptr window) noexcept; + + void initialize_background() noexcept override; + + void set_status(StatusLineSection section, + const std::string_view &str) noexcept override; + +private: + std::unordered_map _sections_lengths; + + std::shared_ptr _cursor_controller; + std::shared_ptr _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; +}; -- cgit v1.2.3-18-g5258