diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-06 13:16:05 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | 0e40bc7ce8c3b3be083002f88c3317d65f6570ad (patch) | |
tree | 2fcc470a0f1ce1d51ff26c53c8a9a890b3f31b3b /src/engine/user/cursor.cpp | |
parent | f4d812a5b9131e65bb55db7211dc68fc453792df (diff) |
refactor: make vector2 & bounds data classes
Diffstat (limited to 'src/engine/user/cursor.cpp')
-rw-r--r-- | src/engine/user/cursor.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/engine/user/cursor.cpp b/src/engine/user/cursor.cpp index 9d6e28c..d4a2997 100644 --- a/src/engine/user/cursor.cpp +++ b/src/engine/user/cursor.cpp @@ -5,29 +5,24 @@ #include <cstdlib> #include <iostream> -CursorController::CursorController(IVector2Factory vector2_factory) - : _vector2_factory(vector2_factory) -{ -} - -void CursorController::move_to(const IVector2 &pos) +void CursorController::move_to(const Vector2 &pos) { fmt::print(MOVE_CURSOR_TO, fmt::arg("esc", ESC), fmt::arg("row", pos.y()), fmt::arg("column", pos.x())); std::cout.flush(); } -std::shared_ptr<IVector2> CursorController::where() +Vector2 CursorController::where() { fmt::print(REQUEST_CURSOR_POSITION, fmt::arg("esc", ESC)); std::cout.flush(); - IVector2Options vector2_options = {}; + Vector2Options vector2_options = {}; // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) scanf("\033[%u;%uR", &vector2_options.y, &vector2_options.x); - return _vector2_factory(vector2_options); + return Vector2(vector2_options); } void CursorController::hide() |