aboutsummaryrefslogtreecommitdiff
path: root/src/commands/insert_cell.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-20 13:17:16 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:56 +0200
commit78f5d8cf644383adf20933ad64c160c07c2c54fb (patch)
tree2a348d90f8f150665c379bf2f3741731999dd679 /src/commands/insert_cell.cpp
parentb6061eff99907495de282f611e8389e6468a1fb0 (diff)
refactor: improve input configuring structure
Diffstat (limited to 'src/commands/insert_cell.cpp')
-rw-r--r--src/commands/insert_cell.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/commands/insert_cell.cpp b/src/commands/insert_cell.cpp
new file mode 100644
index 0000000..86a5a52
--- /dev/null
+++ b/src/commands/insert_cell.cpp
@@ -0,0 +1,24 @@
+#include "insert_cell.hpp"
+
+#include <iostream>
+
+InsertCellCommand::InsertCellCommand(
+ const std::shared_ptr<ICursorController> &cursor_controller,
+ const std::shared_ptr<IScene> &scene) noexcept
+ : _cursor_controller(cursor_controller), _scene(scene)
+{
+}
+
+void InsertCellCommand::execute() noexcept
+{
+ const auto position = _cursor_controller->where();
+
+ std::cout.put('x');
+ std::cout.flush();
+
+ _cursor_controller->move_to(position);
+
+ auto matrix = _scene->get_matrix();
+
+ matrix->set(position - Vector2({.x = 0U, .y = 1U}), "#");
+}