aboutsummaryrefslogtreecommitdiff
path: root/src/game/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/game.cpp')
-rw-r--r--src/game/game.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 4201b7b..d642f7c 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -6,11 +6,11 @@
#include "commands/toggle_pause.hpp"
#include <fmt/core.h>
+
#include <iostream>
#include <utility>
Game::Game(
- std::shared_ptr<IWindow> window,
std::shared_ptr<IScene> scene,
std::shared_ptr<ICursorController> cursor_controller,
std::shared_ptr<IStatusLine> statusline,
@@ -18,8 +18,7 @@ Game::Game(
std::shared_ptr<IStatusManager> status_manager,
IStatusLineSubscriberAdapterFactory<Vector2>
vector2_statusline_subscriber_adapter_factory) noexcept
- : _window(std::move(window)),
- _scene(std::move(scene)),
+ : _scene(std::move(scene)),
_cursor_controller(std::move(cursor_controller)),
_statusline(std::move(statusline)),
_generation_tracker(std::move(generation_tracker)),
@@ -48,11 +47,11 @@ void Game::on_start() noexcept
CursorEvent::POSITION_CHANGE,
vector2_statusline_subscriber_adapter);
- const auto window_size = _window->size();
+ const auto scene_size = _scene->size();
const auto center_position = Vector2(
- {.x = static_cast<Vector2::Value>(window_size.get_width()) / 2,
- .y = static_cast<Vector2::Value>(window_size.get_height()) / 2});
+ {.x = static_cast<Vector2::Value>(scene_size.get_width()) / 2,
+ .y = static_cast<Vector2::Value>(scene_size.get_height()) / 2});
_cursor_controller->move_to(center_position);
@@ -96,20 +95,20 @@ auto Game::get_input_config() const noexcept
{'i', std::make_shared<InsertCellCommand>(_cursor_controller, _scene)},
{'p', std::make_shared<TogglePauseCommand>(_generation_tracker, _status_manager)},
{'k',
- std::make_shared<MoveCursorCommand>(Vector2::up(), _cursor_controller, _window)},
+ std::make_shared<MoveCursorCommand>(Vector2::up(), _cursor_controller, _scene)},
{'j',
std::make_shared<MoveCursorCommand>(
Vector2::down(),
_cursor_controller,
- _window)},
+ _scene)},
{'h',
std::make_shared<MoveCursorCommand>(
Vector2::left(),
_cursor_controller,
- _window)},
+ _scene)},
{'l',
std::make_shared<MoveCursorCommand>(
Vector2::right(),
_cursor_controller,
- _window)}};
+ _scene)}};
}