diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-07 20:20:18 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:55 +0200 |
commit | f0824fdebc79fbf3843c2053522107c33e3ce2a3 (patch) | |
tree | e5bd34fa89cbe80cf8a30596766cf95098465aec /src/engine/user/cursor.cpp | |
parent | 12fffa7df0685ef6d23ffe888a06695ae490df81 (diff) |
refactor: move directions to vector2 & make vector2 hashable
Diffstat (limited to 'src/engine/user/cursor.cpp')
-rw-r--r-- | src/engine/user/cursor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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 <cstdlib> #include <iostream> +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()), |