#pragma once #include "interfaces/matrix.hpp" #include "interfaces/statusline.hpp" #include "engine/data/style.hpp" #include "engine/data/vector2.hpp" #include #include #include constexpr uint32_t STATUSLINE_COLOR = 0x1A1A1AU; class StatusLine : public IStatusLine { public: explicit StatusLine(std::shared_ptr component_matrix) noexcept; auto get() const noexcept -> const std::shared_ptr & override; [[nodiscard]] auto get_need_render() const noexcept -> bool override; void set_need_render(bool need_render) noexcept override; auto get_foreground_color() const noexcept -> uint32_t override; auto get_background_color() const noexcept -> uint32_t override; void set_section_status( StatusLineSection section, const std::string_view &status, int32_t start) noexcept override; void set_section_length(StatusLineSection section, int32_t length) noexcept override; void set_section_style(StatusLineSection section, const Style &style) noexcept override; private: std::shared_ptr _component_matrix; std::unordered_map _section_lengths; std::unordered_map _section_styles; bool _need_render; void _matrix_write_string(const Vector2 &position, const std::string_view &str) noexcept; [[nodiscard]] auto _get_section_start_x(StatusLineSection section) const noexcept -> int32_t; void _clear_section(StatusLineSection section, int32_t start) noexcept; };