aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-12 15:05:33 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:57:02 +0200
commit9cc1b8e5d8fa7b70ac4d36b61b7364032b389b80 (patch)
tree0e71c35360b16071e53b8fadc159ce72507de2df
parent5d00b67cace42eb87ba7f818fb5fccc30e9fd667 (diff)
feat: add current mode to statusline
-rw-r--r--src/game/game.cpp10
1 files changed, 8 insertions, 2 deletions
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<IStatusLine> 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