aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-10 19:12:31 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:55 +0200
commit38f14606c78c119d452f302f17329455e29a9a6f (patch)
tree03f6dfd9d3576e87260f7cb3bc436ad076b629c5 /src/interfaces
parent09848ad31af6a1c70d64fccee711e231afb5a77f (diff)
refactor: rename game initializer & move input config
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/cursor.hpp10
-rw-r--r--src/interfaces/engine.hpp11
-rw-r--r--src/interfaces/game.hpp2
-rw-r--r--src/interfaces/game_initializer.hpp9
-rw-r--r--src/interfaces/input_configurator.hpp9
-rw-r--r--src/interfaces/scene.hpp5
-rw-r--r--src/interfaces/window.hpp9
7 files changed, 33 insertions, 22 deletions
diff --git a/src/interfaces/cursor.hpp b/src/interfaces/cursor.hpp
index adab524..77c5096 100644
--- a/src/interfaces/cursor.hpp
+++ b/src/interfaces/cursor.hpp
@@ -2,16 +2,22 @@
#include "engine/data/vector2.hpp"
+#include <memory>
+
class ICursorController
{
public:
+ virtual ~ICursorController() noexcept = default;
+
virtual void move(const Vector2 &direction, const uint32_t &amount) noexcept = 0;
virtual void move_to(const Vector2 &position) noexcept = 0;
[[nodiscard]] virtual Vector2 where() const noexcept = 0;
- static void hide();
+ virtual void ensure_position() noexcept = 0;
+
+ static void hide() noexcept;
- static void show();
+ static void show() noexcept;
};
diff --git a/src/interfaces/engine.hpp b/src/interfaces/engine.hpp
new file mode 100644
index 0000000..498ff41
--- /dev/null
+++ b/src/interfaces/engine.hpp
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "interfaces/observable.hpp"
+
+#include <unordered_map>
+
+class ICLIGameEngine
+{
+public:
+ virtual void start() noexcept = 0;
+};
diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp
index 85c20e5..338a8a3 100644
--- a/src/interfaces/game.hpp
+++ b/src/interfaces/game.hpp
@@ -10,7 +10,7 @@ class IGame
public:
virtual ~IGame() = default;
- virtual void run(IScene &scene, IInputHandler &input_handler) = 0;
+ virtual void run() = 0;
};
using IGameFactory = std::shared_ptr<IGame> (*)();
diff --git a/src/interfaces/game_initializer.hpp b/src/interfaces/game_initializer.hpp
deleted file mode 100644
index 5dea2e9..0000000
--- a/src/interfaces/game_initializer.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include "interfaces/game.hpp"
-
-class IGameInitializer
-{
-public:
- virtual void initialize() = 0;
-};
diff --git a/src/interfaces/input_configurator.hpp b/src/interfaces/input_configurator.hpp
deleted file mode 100644
index 2bfe51e..0000000
--- a/src/interfaces/input_configurator.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include "interfaces/input.hpp"
-
-class IInputConfigurator
-{
-public:
- virtual void configure(IInputHandler &input_handler) = 0;
-};
diff --git a/src/interfaces/scene.hpp b/src/interfaces/scene.hpp
index 39110a2..ca494cb 100644
--- a/src/interfaces/scene.hpp
+++ b/src/interfaces/scene.hpp
@@ -1,8 +1,9 @@
#pragma once
+#include "interfaces/cursor.hpp"
#include "interfaces/matrix.hpp"
+#include "interfaces/window.hpp"
-#include <functional>
#include <memory>
#include <string_view>
@@ -15,3 +16,5 @@ public:
virtual void leave() = 0;
};
+
+using ISceneFactory = std::shared_ptr<IScene> (*)();
diff --git a/src/interfaces/window.hpp b/src/interfaces/window.hpp
new file mode 100644
index 0000000..5da9aff
--- /dev/null
+++ b/src/interfaces/window.hpp
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "engine/data/bounds.hpp"
+
+class IWindow
+{
+public:
+ [[nodiscard]] virtual Bounds size() const noexcept = 0;
+};