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.tpp | |
parent | 12fffa7df0685ef6d23ffe888a06695ae490df81 (diff) |
refactor: move directions to vector2 & make vector2 hashable
Diffstat (limited to 'src/engine/user/cursor.tpp')
-rw-r--r-- | src/engine/user/cursor.tpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/engine/user/cursor.tpp b/src/engine/user/cursor.tpp deleted file mode 100644 index 0743ae8..0000000 --- a/src/engine/user/cursor.tpp +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "cursor.hpp" - -#include "engine/escape.hpp" - -#include <iostream> - -constexpr auto get_direction_format_map() -{ - std::array<std::string_view, 4> direction_format_map; - - direction_format_map[Direction::UP] = MOVE_CURSOR_UP; - direction_format_map[Direction::DOWN] = MOVE_CURSOR_DOWN; - direction_format_map[Direction::LEFT] = MOVE_CURSOR_LEFT; - direction_format_map[Direction::RIGHT] = MOVE_CURSOR_RIGHT; - - return direction_format_map; -} - -template <Direction::value_type direction> -constexpr void CursorController::move(const uint32_t &amount) const -{ - constexpr auto direction_format_map = get_direction_format_map(); - - constexpr auto format = direction_format_map[direction]; - - fmt::vprint(format, - fmt::make_format_args(fmt::arg("esc", ESC), fmt::arg("amount", amount))); - std::cout.flush(); -} |