diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-15 19:57:02 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:59 +0200 |
commit | 019337908e37ffee9b624b313e9d7f885bff9781 (patch) | |
tree | 7f8ba5e8b12fff7723b1af2317c3fba52c0c7011 /src/game/game.cpp | |
parent | 741a6008e806abb8e5aaa8f8fb91827fa97ece9d (diff) |
style: change braced list & bracket style
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r-- | src/game/game.cpp | 76 |
1 files changed, 30 insertions, 46 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 02a0f65..4201b7b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -17,8 +17,7 @@ Game::Game( std::shared_ptr<IGenerationTracker> generation_tracker, std::shared_ptr<IStatusManager> status_manager, IStatusLineSubscriberAdapterFactory<Vector2> - vector2_statusline_subscriber_adapter_factory -) noexcept + vector2_statusline_subscriber_adapter_factory) noexcept : _window(std::move(window)), _scene(std::move(scene)), _cursor_controller(std::move(cursor_controller)), @@ -26,8 +25,7 @@ Game::Game( _generation_tracker(std::move(generation_tracker)), _status_manager(std::move(status_manager)), _vector2_statusline_subscriber_adapter_factory( - vector2_statusline_subscriber_adapter_factory - ) + vector2_statusline_subscriber_adapter_factory) { } @@ -44,36 +42,31 @@ void Game::on_start() noexcept std::shared_ptr<ISubscriber<Vector2>> vector2_statusline_subscriber_adapter = _vector2_statusline_subscriber_adapter_factory( _status_manager, - { StatusLineSection::B, StatusLineSection::C } - ); + {StatusLineSection::B, StatusLineSection::C}); _cursor_controller->subscribe( CursorEvent::POSITION_CHANGE, - vector2_statusline_subscriber_adapter - ); + vector2_statusline_subscriber_adapter); const auto window_size = _window->size(); - const auto center_position = - Vector2({ .x = static_cast<Vector2::Value>(window_size.get_width()) / 2, - .y = static_cast<Vector2::Value>(window_size.get_height()) / 2 }); + const auto center_position = Vector2( + {.x = static_cast<Vector2::Value>(window_size.get_width()) / 2, + .y = static_cast<Vector2::Value>(window_size.get_height()) / 2}); _cursor_controller->move_to(center_position); _status_manager->set_section_body( StatusLineSection::B, - fmt::format("{}", center_position.get_x()) - ); + fmt::format("{}", center_position.get_x())); _status_manager->set_section_body( StatusLineSection::C, - fmt::format("{}", center_position.get_y()) - ); + fmt::format("{}", center_position.get_y())); _status_manager->set_section_body( StatusLineSection::D, - _generation_tracker->get_is_paused() ? "yes" : "no" - ); + _generation_tracker->get_is_paused() ? "yes" : "no"); _status_manager->set_section_body(StatusLineSection::E, "0"); } @@ -99,33 +92,24 @@ auto Game::get_input_config() const noexcept -> std::unordered_map<char, std::shared_ptr<ICommand>> { return { - { 'q', std::make_shared<QuitCommand>() }, - { 'i', std::make_shared<InsertCellCommand>(_cursor_controller, _scene) }, - { 'p', - std::make_shared<TogglePauseCommand>(_generation_tracker, _status_manager) }, - { 'k', - std::make_shared<MoveCursorCommand>( - Vector2::up(), - _cursor_controller, - _window - ) }, - { 'j', - std::make_shared<MoveCursorCommand>( - Vector2::down(), - _cursor_controller, - _window - ) }, - { 'h', - std::make_shared<MoveCursorCommand>( - Vector2::left(), - _cursor_controller, - _window - ) }, - { 'l', - std::make_shared<MoveCursorCommand>( - Vector2::right(), - _cursor_controller, - _window - ) } - }; + {'q', std::make_shared<QuitCommand>()}, + {'i', std::make_shared<InsertCellCommand>(_cursor_controller, _scene)}, + {'p', std::make_shared<TogglePauseCommand>(_generation_tracker, _status_manager)}, + {'k', + std::make_shared<MoveCursorCommand>(Vector2::up(), _cursor_controller, _window)}, + {'j', + std::make_shared<MoveCursorCommand>( + Vector2::down(), + _cursor_controller, + _window)}, + {'h', + std::make_shared<MoveCursorCommand>( + Vector2::left(), + _cursor_controller, + _window)}, + {'l', + std::make_shared<MoveCursorCommand>( + Vector2::right(), + _cursor_controller, + _window)}}; } |