diff options
| author | HampusM <hampus@hampusmat.com> | 2022-06-12 14:46:38 +0200 | 
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:02 +0200 | 
| commit | 44d7fec2624dd5a59fc93e229c0e3221f8311278 (patch) | |
| tree | 9046572d211fe89c5bf6e33fce0fb4dd76eb7d0f /src/game | |
| parent | a0c38153cffbed95786863ad3edd710ec3f79fb0 (diff) | |
refactor: improve configuring cursor style
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/game.cpp | 8 | ||||
| -rw-r--r-- | src/game/game.hpp | 3 | 
2 files changed, 9 insertions, 2 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 3f76b05..95bedb9 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -36,6 +36,8 @@ Game::Game(  	  _cell_helper(std::move(cell_helper)),  	  _rle_reader(std::move(rle_reader)),  	  _current_mode(Mode::NORMAL), +	  _normal_mode_cursor_style(CursorStyle::BlinkingBlock), +	  _command_mode_cursor_style(CursorStyle::SteadyBar),  	  _minimum_cursor_pos_y(0)  {  } @@ -87,6 +89,8 @@ void Game::on_start() noexcept  		StatusLineSection::G,  		fmt::format("{}x{}", scene_size.get_width(), scene_size.get_height())); +	_cursor_controller->set_cursor_style(_normal_mode_cursor_style); +  	_commands["open"] = CommandInfo(  		{.option_cnt = 1U,  		 .function = [this](CommandInfo::Options options) @@ -237,7 +241,7 @@ void Game::_on_normal_mode_update() noexcept  		_cursor_controller->update_position(  			_cursor_controller->where() + Vector2::right()); -		_cursor_controller->set_cursor_style(CursorStyle::BlinkingBar); +		_cursor_controller->set_cursor_style(_command_mode_cursor_style);  		_command_mode_input = ""; @@ -496,7 +500,7 @@ void Game::_return_to_normal_mode() noexcept  	_cursor_controller->move_to(_last_pos_before_command_mode.value_or(  		Vector2({.x = CURSOR_FALLBACK_POS_X, .y = CURSOR_FALLBACK_POS_Y}))); -	_cursor_controller->set_cursor_style(CursorStyle::BlinkingBlock); +	_cursor_controller->set_cursor_style(_normal_mode_cursor_style);  	_current_mode = Mode::NORMAL;  } diff --git a/src/game/game.hpp b/src/game/game.hpp index 09a9ee0..e69ce46 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -83,6 +83,9 @@ private:  	Mode _current_mode; +	CursorStyle _normal_mode_cursor_style; +	CursorStyle _command_mode_cursor_style; +  	int32_t _minimum_cursor_pos_y;  	std::optional<Vector2> _last_pos_before_command_mode;  | 
