From 019337908e37ffee9b624b313e9d7f885bff9781 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 15 May 2022 19:57:02 +0200 Subject: style: change braced list & bracket style --- src/game/game.cpp | 76 ++++++++++++------------------ src/game/game.hpp | 3 +- src/game/status_manager.cpp | 6 +-- src/game/status_manager.hpp | 6 +-- src/game/statusline_subscriber_adapter.hpp | 3 +- src/game/statusline_subscriber_adapter.tpp | 2 +- 6 files changed, 37 insertions(+), 59 deletions(-) (limited to 'src/game') 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 generation_tracker, std::shared_ptr status_manager, IStatusLineSubscriberAdapterFactory - 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> 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(window_size.get_width()) / 2, - .y = static_cast(window_size.get_height()) / 2 }); + const auto center_position = Vector2( + {.x = static_cast(window_size.get_width()) / 2, + .y = static_cast(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> { return { - { 'q', std::make_shared() }, - { 'i', std::make_shared(_cursor_controller, _scene) }, - { 'p', - std::make_shared(_generation_tracker, _status_manager) }, - { 'k', - std::make_shared( - Vector2::up(), - _cursor_controller, - _window - ) }, - { 'j', - std::make_shared( - Vector2::down(), - _cursor_controller, - _window - ) }, - { 'h', - std::make_shared( - Vector2::left(), - _cursor_controller, - _window - ) }, - { 'l', - std::make_shared( - Vector2::right(), - _cursor_controller, - _window - ) } - }; + {'q', std::make_shared()}, + {'i', std::make_shared(_cursor_controller, _scene)}, + {'p', std::make_shared(_generation_tracker, _status_manager)}, + {'k', + std::make_shared(Vector2::up(), _cursor_controller, _window)}, + {'j', + std::make_shared( + Vector2::down(), + _cursor_controller, + _window)}, + {'h', + std::make_shared( + Vector2::left(), + _cursor_controller, + _window)}, + {'l', + std::make_shared( + Vector2::right(), + _cursor_controller, + _window)}}; } diff --git a/src/game/game.hpp b/src/game/game.hpp index 9689215..fac9061 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -22,8 +22,7 @@ public: std::shared_ptr generation_tracker, std::shared_ptr status_manager, IStatusLineSubscriberAdapterFactory - vector2_statusline_subscriber_adapter_factory - ) noexcept; + vector2_statusline_subscriber_adapter_factory) noexcept; void on_start() noexcept override; diff --git a/src/game/status_manager.cpp b/src/game/status_manager.cpp index 727452c..927f645 100644 --- a/src/game/status_manager.cpp +++ b/src/game/status_manager.cpp @@ -18,8 +18,7 @@ StatusManager::StatusManager(std::shared_ptr statusline) noexcept void StatusManager::set_section_title( const StatusLineSection §ion, - const std::string_view &title -) noexcept + const std::string_view &title) noexcept { if (_title_lengths.count(section) != 0) { @@ -34,8 +33,7 @@ void StatusManager::set_section_title( void StatusManager::set_section_body( const StatusLineSection §ion, - const std::string_view &body -) noexcept + const std::string_view &body) noexcept { auto section_title_length = _title_lengths[section]; diff --git a/src/game/status_manager.hpp b/src/game/status_manager.hpp index 62b5bc7..cdc9de5 100644 --- a/src/game/status_manager.hpp +++ b/src/game/status_manager.hpp @@ -17,13 +17,11 @@ public: void set_section_title( const StatusLineSection §ion, - const std::string_view &title - ) noexcept override; + const std::string_view &title) noexcept override; void set_section_body( const StatusLineSection §ion, - const std::string_view &body - ) noexcept override; + const std::string_view &body) noexcept override; private: std::shared_ptr _statusline; diff --git a/src/game/statusline_subscriber_adapter.hpp b/src/game/statusline_subscriber_adapter.hpp index d53ae04..c0c5805 100644 --- a/src/game/statusline_subscriber_adapter.hpp +++ b/src/game/statusline_subscriber_adapter.hpp @@ -15,8 +15,7 @@ public: StatusLineSubscriberAdapter( std::shared_ptr status_manager, std::string (*format_func)(std::size_t section_index, const Context &context), - const std::vector §ions - ) noexcept; + const std::vector §ions) noexcept; void update(const Context &context) noexcept override; diff --git a/src/game/statusline_subscriber_adapter.tpp b/src/game/statusline_subscriber_adapter.tpp index 1de459c..9054772 100644 --- a/src/game/statusline_subscriber_adapter.tpp +++ b/src/game/statusline_subscriber_adapter.tpp @@ -10,7 +10,7 @@ StatusLineSubscriberAdapter::StatusLineSubscriberAdapter( std::string (*format_func)(std::size_t section_index, const Context &context), const std::vector §ions -) noexcept + ) noexcept : _status_manager(std::move(status_manager)), _format_func(format_func), _sections(sections) -- cgit v1.2.3-18-g5258