aboutsummaryrefslogtreecommitdiff
path: root/src/game/game.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/game.hpp')
-rw-r--r--src/game/game.hpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 0ffa1d6..d29f4b6 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -1,15 +1,23 @@
#pragma once
+#include "interfaces/cell_helper.hpp"
#include "interfaces/cursor.hpp"
#include "interfaces/game.hpp"
#include "interfaces/generation_tracker.hpp"
#include "interfaces/input.hpp"
+#include "interfaces/matrix.hpp"
#include "interfaces/scene.hpp"
#include "interfaces/status_manager.hpp"
+#include "engine/data/vector2.hpp"
+
#include <chrono>
+#include <cstddef>
+#include <list>
#include <memory>
+constexpr auto GENERATION_UPDATE_SPEED_MILLIS = 1000;
+
class Game : public IGame
{
public:
@@ -18,7 +26,8 @@ public:
std::shared_ptr<ICursorController> cursor_controller,
std::shared_ptr<IGenerationTracker> generation_tracker,
std::shared_ptr<IStatusManager> status_manager,
- std::shared_ptr<IUserInputObserver> user_input_observer) noexcept;
+ std::shared_ptr<IUserInputObserver> user_input_observer,
+ std::shared_ptr<ICellHelper> cell_helper) noexcept;
void on_start() noexcept override;
@@ -32,15 +41,19 @@ private:
std::shared_ptr<IGenerationTracker> _generation_tracker;
std::shared_ptr<IStatusManager> _status_manager;
std::shared_ptr<IUserInputObserver> _user_input_observer;
+ std::shared_ptr<ICellHelper> _cell_helper;
using TimePoint = std::chrono::system_clock::time_point;
TimePoint _last_update_time;
TimePoint _last_gen_update_time;
- int _gen_update_speed_millis;
+ std::list<Vector2> _living_cell_positions;
void _move_cursor(const Vector2 &direction) noexcept;
- void _insert_cell(const Vector2 &position, char cell) noexcept;
+ void _set_space(
+ const std::shared_ptr<IMatrix<IScene::MatrixElement>> &matrix,
+ const Vector2 &position,
+ char character) noexcept;
};