From 9cc1b8e5d8fa7b70ac4d36b61b7364032b389b80 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 12 Jun 2022 15:05:33 +0200 Subject: feat: add current mode to statusline --- src/game/game.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/game') diff --git a/src/game/game.cpp b/src/game/game.cpp index ad95bd4..2f6c09c 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -49,7 +49,7 @@ void Game::on_start() noexcept std::shared_ptr statusline = _statusline_factory(Bounds({.width = scene_size.get_width(), .height = 1})); - const auto statusline_section_a_length = 5; + const auto statusline_section_a_length = 15; const auto statusline_section_b_length = 15; const auto statusline_section_c_length = 15; const auto statusline_section_d_length = 20; @@ -73,7 +73,7 @@ void Game::on_start() noexcept _minimum_cursor_pos_y = 2; - _status_manager->set_section_title(StatusLineSection::A, ""); + _status_manager->set_section_title(StatusLineSection::A, " "); _status_manager->set_section_title(StatusLineSection::B, "X: "); _status_manager->set_section_title(StatusLineSection::C, "Y: "); _status_manager->set_section_title(StatusLineSection::D, "Paused: "); @@ -87,6 +87,8 @@ void Game::on_start() noexcept _cursor_controller->move_to(center_position); + _status_manager->set_section_body(StatusLineSection::A, "NORMAL"); + _status_manager->set_section_body( StatusLineSection::B, fmt::format("{}", center_position.get_x())); @@ -264,6 +266,8 @@ void Game::_on_normal_mode_update() noexcept _command_mode_input = ""; _current_mode = Mode::COMMAND; + + _status_manager->set_section_body(StatusLineSection::A, "COMMAND"); return; case 'i': @@ -521,6 +525,8 @@ void Game::_return_to_normal_mode() noexcept _cursor_controller->set_cursor_style(_normal_mode_cursor_style); _current_mode = Mode::NORMAL; + + _status_manager->set_section_body(StatusLineSection::A, "NORMAL"); } void Game::_run_command(const std::string &command) noexcept -- cgit v1.2.3-18-g5258