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/engine/user/cursor.cpp | 13 +++++-------- src/engine/user/cursor.hpp | 10 +++++----- src/engine/user/input.cpp | 3 +-- src/engine/user/input.hpp | 3 +-- 4 files changed, 12 insertions(+), 17 deletions(-) (limited to 'src/engine/user') diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp index 71f02da..945433b 100644 --- a/src/engine/user/cursor.cpp +++ b/src/engine/user/cursor.cpp @@ -5,7 +5,7 @@ #include #include -CursorController::CursorController() noexcept : _position({ .x = 0, .y = 0 }) {} +CursorController::CursorController() noexcept : _position({.x = 0, .y = 0}) {} void CursorController::move(const Vector2 &direction, const uint32_t &amount) noexcept { @@ -14,8 +14,7 @@ void CursorController::move(const Vector2 &direction, const uint32_t &amount) no fmt::print( fmt::runtime(direction_format.data()), fmt::arg("esc", ESC), - fmt::arg("amount", amount) - ); + fmt::arg("amount", amount)); std::cout.flush(); _position = _position.to_direction(direction, static_cast(amount)); @@ -29,8 +28,7 @@ void CursorController::move_to(const Vector2 &position, bool silent) noexcept MOVE_CURSOR_TO, fmt::arg("esc", ESC), fmt::arg("row", position.get_y()), - fmt::arg("column", position.get_x()) - ); + fmt::arg("column", position.get_x())); std::cout.flush(); _position = position; @@ -75,12 +73,11 @@ void CursorController::show() noexcept void CursorController::subscribe( const Event &event, - const Subscriber &subscriber -) noexcept + const Subscriber &subscriber) noexcept { if (_subscribers.count(event) == 0) { - _subscribers.insert({ event, std::vector() }); + _subscribers.insert({event, std::vector()}); } _subscribers.at(event).push_back(subscriber); diff --git a/src/engine/user/cursor.hpp b/src/engine/user/cursor.hpp index 080321e..ae6fe3c 100644 --- a/src/engine/user/cursor.hpp +++ b/src/engine/user/cursor.hpp @@ -24,11 +24,11 @@ constexpr fmt::string_view REQUEST_CURSOR_POSITION = "{esc}[6n"; constexpr fmt::string_view CURSOR_VISIBLE = "{esc}[?25h"; constexpr fmt::string_view CURSOR_INVISIBLE = "{esc}[?25l"; -const std::unordered_map - direction_format_map = { { Vector2::up(), MOVE_CURSOR_UP }, - { Vector2::down(), MOVE_CURSOR_DOWN }, - { Vector2::left(), MOVE_CURSOR_LEFT }, - { Vector2::right(), MOVE_CURSOR_RIGHT } }; +const std::unordered_map direction_format_map = + {{Vector2::up(), MOVE_CURSOR_UP}, + {Vector2::down(), MOVE_CURSOR_DOWN}, + {Vector2::left(), MOVE_CURSOR_LEFT}, + {Vector2::right(), MOVE_CURSOR_RIGHT}}; class CursorController : public ICursorController, public yacppdic::AutoWirable diff --git a/src/engine/user/input.cpp b/src/engine/user/input.cpp index d335fc9..7e9fe22 100644 --- a/src/engine/user/input.cpp +++ b/src/engine/user/input.cpp @@ -15,8 +15,7 @@ void InputHandler::listen() const noexcept void InputHandler::subscribe( const Event &event, - const std::shared_ptr> &subscriber -) noexcept + const std::shared_ptr> &subscriber) noexcept { auto event_index = _event_as_index(event); diff --git a/src/engine/user/input.hpp b/src/engine/user/input.hpp index c88809d..f17472b 100644 --- a/src/engine/user/input.hpp +++ b/src/engine/user/input.hpp @@ -21,8 +21,7 @@ public: void subscribe( const Event &event, - const std::shared_ptr> &subscriber - ) noexcept override; + const std::shared_ptr> &subscriber) noexcept override; void notify_subscribers(const Event &event, const Context &context) const noexcept override; -- cgit v1.2.3-18-g5258