From 38f14606c78c119d452f302f17329455e29a9a6f Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 10 Mar 2022 19:12:31 +0100 Subject: refactor: rename game initializer & move input config --- src/interfaces/cursor.hpp | 10 ++++++++-- src/interfaces/engine.hpp | 11 +++++++++++ src/interfaces/game.hpp | 2 +- src/interfaces/game_initializer.hpp | 9 --------- src/interfaces/input_configurator.hpp | 9 --------- src/interfaces/scene.hpp | 5 ++++- src/interfaces/window.hpp | 9 +++++++++ 7 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 src/interfaces/engine.hpp delete mode 100644 src/interfaces/game_initializer.hpp delete mode 100644 src/interfaces/input_configurator.hpp create mode 100644 src/interfaces/window.hpp (limited to 'src/interfaces') 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 + 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 + +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 (*)(); 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 #include #include @@ -15,3 +16,5 @@ public: virtual void leave() = 0; }; + +using ISceneFactory = std::shared_ptr (*)(); 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; +}; -- cgit v1.2.3-18-g5258