aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cpp13
-rw-r--r--src/game/game.hpp14
-rw-r--r--src/game/input_configurator.cpp41
-rw-r--r--src/game/input_configurator.hpp33
4 files changed, 4 insertions, 97 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 0773f2c..dafa847 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -1,14 +1,3 @@
#include "game.hpp"
-#include <utility>
-
-Game::Game(std::shared_ptr<IInputConfigurator> input_configurator)
- : _input_configurator(std::move(input_configurator))
-{
-}
-
-void Game::run(IScene & /*scene*/, IInputHandler &input_handler)
-{
- _input_configurator->configure(input_handler);
- input_handler.listen();
-}
+void Game::run() {}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index ea8145a..2111026 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -2,19 +2,11 @@
#include "DI/auto_wirable.hpp"
#include "interfaces/game.hpp"
-#include "interfaces/input.hpp"
-#include "interfaces/input_configurator.hpp"
-#include "interfaces/scene.hpp"
-#include <memory>
-
-class Game : public IGame, public AutoWirable<IGame, Game, IInputConfigurator>
+class Game : public IGame, public AutoWirable<IGame, Game>
{
public:
- explicit Game(std::shared_ptr<IInputConfigurator> input_configurator);
-
- void run(IScene &scene, IInputHandler &input_handler) override;
+ Game() = default;
-private:
- std::shared_ptr<IInputConfigurator> _input_configurator;
+ void run() override;
};
diff --git a/src/game/input_configurator.cpp b/src/game/input_configurator.cpp
deleted file mode 100644
index 76e5b66..0000000
--- a/src/game/input_configurator.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "input_configurator.hpp"
-
-namespace InputActions
-{
-
-void exit_success()
-{
- exit(EXIT_SUCCESS);
-}
-
-auto move_cursor(const Vector2 &direction, ICursorController &cursor_controller)
-{
- return [direction, &cursor_controller]()
- {
- cursor_controller.move(direction, 1U);
- };
-}
-
-} // namespace InputActions
-
-InputConfigurator::InputConfigurator(std::shared_ptr<ICursorController> cursor_controller)
- : _cursor_controller(std::move(cursor_controller))
-{
-}
-
-void InputConfigurator::configure(IInputHandler &input_handler)
-{
- input_handler.attach('q', InputActions::exit_success);
-
- input_handler.attach('k',
- InputActions::move_cursor(Vector2::up(), *_cursor_controller));
-
- input_handler.attach('j',
- InputActions::move_cursor(Vector2::down(), *_cursor_controller));
-
- input_handler.attach('h',
- InputActions::move_cursor(Vector2::left(), *_cursor_controller));
-
- input_handler.attach(
- 'l', InputActions::move_cursor(Vector2::right(), *_cursor_controller));
-}
diff --git a/src/game/input_configurator.hpp b/src/game/input_configurator.hpp
deleted file mode 100644
index fa501c7..0000000
--- a/src/game/input_configurator.hpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#pragma once
-
-#include "DI/auto_wirable.hpp"
-#include "interfaces/cursor.hpp"
-#include "interfaces/input.hpp"
-#include "interfaces/input_configurator.hpp"
-
-#include "engine/data/vector2.hpp"
-
-#include <array>
-#include <memory>
-
-namespace InputActions
-{
-
-auto move_cursor(const Vector2 &direction, ICursorController &cursor_controller);
-
-void exit_success();
-
-} // namespace InputActions
-
-class InputConfigurator
- : public IInputConfigurator,
- public AutoWirable<IInputConfigurator, InputConfigurator, ICursorController>
-{
-public:
- explicit InputConfigurator(std::shared_ptr<ICursorController> cursor_controller);
-
- void configure(IInputHandler &input_handler) override;
-
-private:
- std::shared_ptr<ICursorController> _cursor_controller;
-};