aboutsummaryrefslogtreecommitdiff
path: root/src/commands/insert_cell.cpp
blob: 3aa0fc811ee855cd9a367256e8a29e3226eb4499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#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}), "#");
}