aboutsummaryrefslogtreecommitdiff
path: root/src/engine/user/cursor.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-04-24 17:13:52 +0200
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:58 +0200
commitdb6edcd473a684420e9a7611b24462df21165c1b (patch)
tree9646bdb4f5f6e339a0a01873b44e0b185476ce56 /src/engine/user/cursor.cpp
parentb36d072ad7a7b9c6e30fcb25d6bbb001a8393468 (diff)
style: improve function and brace styling
Diffstat (limited to 'src/engine/user/cursor.cpp')
-rw-r--r--src/engine/user/cursor.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp
index 2b240b9..71f02da 100644
--- a/src/engine/user/cursor.cpp
+++ b/src/engine/user/cursor.cpp
@@ -5,14 +5,17 @@
#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
{
auto direction_format = direction_format_map.at(direction);
- fmt::print(fmt::runtime(direction_format.data()), fmt::arg("esc", ESC),
- fmt::arg("amount", amount));
+ fmt::print(
+ fmt::runtime(direction_format.data()),
+ fmt::arg("esc", ESC),
+ fmt::arg("amount", amount)
+ );
std::cout.flush();
_position = _position.to_direction(direction, static_cast<Vector2::Value>(amount));
@@ -22,8 +25,12 @@ void CursorController::move(const Vector2 &direction, const uint32_t &amount) no
void CursorController::move_to(const Vector2 &position, bool silent) noexcept
{
- fmt::print(MOVE_CURSOR_TO, fmt::arg("esc", ESC), fmt::arg("row", position.get_y()),
- fmt::arg("column", position.get_x()));
+ fmt::print(
+ MOVE_CURSOR_TO,
+ fmt::arg("esc", ESC),
+ fmt::arg("row", position.get_y()),
+ fmt::arg("column", position.get_x())
+ );
std::cout.flush();
_position = position;
@@ -66,19 +73,21 @@ void CursorController::show() noexcept
std::cout.flush();
}
-void CursorController::subscribe(const Event &event,
- const Subscriber &subscriber) noexcept
+void CursorController::subscribe(
+ const Event &event,
+ 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);
}
-void CursorController::notify_subscribers(const Event &event,
- const Context &context) const noexcept
+void CursorController::notify_subscribers(const Event &event, const Context &context)
+ const noexcept
{
if (_subscribers.count(event) == 0)
{