diff options
author | HampusM <hampus@hampusmat.com> | 2022-04-24 17:13:52 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:58 +0200 |
commit | db6edcd473a684420e9a7611b24462df21165c1b (patch) | |
tree | 9646bdb4f5f6e339a0a01873b44e0b185476ce56 /src/game/statusline.cpp | |
parent | b36d072ad7a7b9c6e30fcb25d6bbb001a8393468 (diff) |
style: improve function and brace styling
Diffstat (limited to 'src/game/statusline.cpp')
-rw-r--r-- | src/game/statusline.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/game/statusline.cpp b/src/game/statusline.cpp index 6becb38..d764d60 100644 --- a/src/game/statusline.cpp +++ b/src/game/statusline.cpp @@ -7,8 +7,10 @@ #include <string> #include <utility> -StatusLine::StatusLine(std::shared_ptr<ICursorController> cursor_controller, - std::shared_ptr<IWindow> window) noexcept +StatusLine::StatusLine( + std::shared_ptr<ICursorController> cursor_controller, + std::shared_ptr<IWindow> window +) noexcept : _cursor_controller(std::move(cursor_controller)), _window(std::move(window)) { constexpr uint32_t SECTION_A_LENGTH = 20; @@ -30,8 +32,10 @@ void StatusLine::initialize_background() noexcept _move_back(previous_position); } -void StatusLine::set_status(StatusLineSection section, - const std::string_view &str) noexcept +void StatusLine::set_status( + StatusLineSection section, + const std::string_view &statusline_str +) noexcept { _clear_section(section); @@ -43,7 +47,9 @@ void StatusLine::set_status(StatusLineSection section, auto section_length = _sections_lengths[section]; - auto status = str.length() > section_length ? str.substr(0, section_length) : str; + auto status = statusline_str.length() > section_length + ? statusline_str.substr(0, section_length) + : statusline_str; fmt::print("{}{}", background_color, status); fmt::print(RESET_ALL_MODES, fmt::arg("esc", ESC)); @@ -61,7 +67,7 @@ auto StatusLine::_move_to_statusline(int32_t x) noexcept -> Vector2 auto window_height = static_cast<Vector2::Value>(window_size.get_height()); - _cursor_controller->move_to(Vector2({.x = x, .y = window_height}), true); + _cursor_controller->move_to(Vector2({ .x = x, .y = window_height }), true); return previous_position; } @@ -80,8 +86,9 @@ auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept while (section_index > 0) { - section_start += static_cast<int32_t>( - _sections_lengths.at(StatusLineSection(section_index - 1))); + section_start += + static_cast<int32_t>(_sections_lengths.at(StatusLineSection(section_index - 1) + )); section_index--; } |