diff options
Diffstat (limited to 'src/game/components/statusline.cpp')
-rw-r--r-- | src/game/components/statusline.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/game/components/statusline.cpp b/src/game/components/statusline.cpp index aac1c27..8344c22 100644 --- a/src/game/components/statusline.cpp +++ b/src/game/components/statusline.cpp @@ -1,12 +1,11 @@ #include "statusline.hpp" #include <fmt/color.h> +#include <range/v3/view/iota.hpp> #include <utility> #include "engine/data/vector2.hpp" #include "interfaces/matrix.hpp" -#include "util/ranges.hpp" -#include "util/ranges_impl.hpp" StatusLine::StatusLine(std::shared_ptr<ComponentMatrix> component_matrix) noexcept : _component_matrix(std::move(component_matrix)), _need_render(false) @@ -55,7 +54,8 @@ void StatusLine::set_section_status( auto pos = Vector2({.x = section_start + start, .y = 0}); - const auto column_cnt = static_cast<std::int32_t>(_component_matrix->get_column_cnt()); + const auto column_cnt = + static_cast<std::int32_t>(_component_matrix->get_column_cnt()); const auto section_length = _section_lengths[section]; @@ -73,7 +73,7 @@ void StatusLine::set_section_status( _component_matrix->set(pos, {.value = ' ', .style = section_style}); padding_remaining--; - for (auto index : IotaView(0U, padding_remaining)) + for (auto index : ranges::views::iota(0U, padding_remaining)) { pos += Vector2::right(); @@ -103,11 +103,13 @@ void StatusLine::set_section_status( _matrix_write_string( pos, - status.substr(status_offset_start, static_cast<std::uint32_t>(final_status_length))); + status.substr( + status_offset_start, + static_cast<std::uint32_t>(final_status_length))); pos = pos.to_direction(Vector2::right(), final_status_length); - for (auto index : IotaView(0U, section_style.padding_right)) + for (auto index : ranges::views::iota(0U, section_style.padding_right)) { _component_matrix->set(pos, {.value = ' '}); @@ -119,7 +121,9 @@ void StatusLine::set_section_status( set_need_render(true); } -void StatusLine::set_section_length(StatusLineSection section, std::int32_t length) noexcept +void StatusLine::set_section_length( + StatusLineSection section, + std::int32_t length) noexcept { _section_lengths[section] = length; } @@ -143,7 +147,8 @@ void StatusLine::_matrix_write_string( } } -auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept -> std::int32_t +auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept + -> std::int32_t { std::int32_t section_start = 0; @@ -169,7 +174,7 @@ void StatusLine::_clear_section(StatusLineSection section, std::int32_t start) n auto section_length = _section_lengths[section]; - for (auto index : IotaView(0, section_length - start)) + for (auto index : ranges::views::iota(0, section_length - start)) { _component_matrix->set(pos, ComponentElement({.value = ' '})); |