From f0824fdebc79fbf3843c2053522107c33e3ce2a3 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 7 Mar 2022 20:20:18 +0100 Subject: refactor: move directions to vector2 & make vector2 hashable --- src/engine/user/cursor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/engine/user/cursor.cpp') diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp index 44e24dc..391a91a 100644 --- a/src/engine/user/cursor.cpp +++ b/src/engine/user/cursor.cpp @@ -5,6 +5,15 @@ #include #include +void CursorController::move(const Vector2 &direction, const uint32_t &amount) +{ + auto format = direction_format_map.at(direction); + + fmt::print(fmt::runtime(format.data()), fmt::arg("esc", ESC), + fmt::arg("amount", amount)); + std::cout.flush(); +} + void CursorController::move_to(const Vector2 &pos) { fmt::print(MOVE_CURSOR_TO, fmt::arg("esc", ESC), fmt::arg("row", pos.get_y()), -- cgit v1.2.3-18-g5258