aboutsummaryrefslogtreecommitdiff
path: root/src/engine/user
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/user')
-rw-r--r--src/engine/user/cursor.cpp13
-rw-r--r--src/engine/user/cursor.hpp10
-rw-r--r--src/engine/user/input.cpp3
-rw-r--r--src/engine/user/input.hpp3
4 files changed, 12 insertions, 17 deletions
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 <cstdlib>
#include <iostream>
-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<Vector2::Value>(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<Subscriber>() });
+ _subscribers.insert({event, std::vector<Subscriber>()});
}
_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<Vector2, std::string_view, Vector2Hasher>
- 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<Vector2, std::string_view, Vector2Hasher> 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<ICursorController, CursorController>
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<ISubscriber<Context>> &subscriber
-) noexcept
+ const std::shared_ptr<ISubscriber<Context>> &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<ISubscriber<Context>> &subscriber
- ) noexcept override;
+ const std::shared_ptr<ISubscriber<Context>> &subscriber) noexcept override;
void notify_subscribers(const Event &event, const Context &context)
const noexcept override;