diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-22 17:05:00 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:59 +0200 |
commit | 7de921836587cdc359c2c4b84ed6446ada16c008 (patch) | |
tree | c4ec20b4769817c41ce7d939956da297bf787597 /src/game | |
parent | 723ea6535b4c4e5605e5592137a898d6ffa458c1 (diff) |
refactor: remove window class
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 19 | ||||
-rw-r--r-- | src/game/game.hpp | 3 |
2 files changed, 9 insertions, 13 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)}}; } diff --git a/src/game/game.hpp b/src/game/game.hpp index fac9061..c765312 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -7,7 +7,6 @@ #include "interfaces/status_manager.hpp" #include "interfaces/statusline.hpp" #include "interfaces/statusline_subscriber_adapter.hpp" -#include "interfaces/window.hpp" #include <memory> @@ -15,7 +14,6 @@ class Game : public IGame { public: Game( - std::shared_ptr<IWindow> window, std::shared_ptr<IScene> scene, std::shared_ptr<ICursorController> cursor_controller, std::shared_ptr<IStatusLine> statusline, @@ -34,7 +32,6 @@ public: -> std::unordered_map<char, std::shared_ptr<ICommand>> override; private: - std::shared_ptr<IWindow> _window; std::shared_ptr<IScene> _scene; std::shared_ptr<ICursorController> _cursor_controller; std::shared_ptr<IStatusLine> _statusline; |