aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/command.hpp19
-rw-r--r--src/interfaces/cursor.hpp16
-rw-r--r--src/interfaces/game.hpp1
-rw-r--r--src/interfaces/input.hpp3
-rw-r--r--src/interfaces/publisher.hpp21
-rw-r--r--src/interfaces/statusline_subscriber_adapter.hpp16
-rw-r--r--src/interfaces/subscriber.hpp11
7 files changed, 3 insertions, 84 deletions
diff --git a/src/interfaces/command.hpp b/src/interfaces/command.hpp
deleted file mode 100644
index f433eab..0000000
--- a/src/interfaces/command.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-
-#include "interfaces/subscriber.hpp"
-
-#include <cstddef>
-
-// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
-class ICommand : public ISubscriber<std::nullptr_t>
-{
-public:
- ~ICommand() override = default;
-
- virtual void execute() noexcept = 0;
-
- void update(const std::nullptr_t & /*context*/) noexcept override
- {
- execute();
- };
-};
diff --git a/src/interfaces/cursor.hpp b/src/interfaces/cursor.hpp
index 053ff40..63aae41 100644
--- a/src/interfaces/cursor.hpp
+++ b/src/interfaces/cursor.hpp
@@ -1,8 +1,5 @@
#pragma once
-#include "interfaces/publisher.hpp"
-#include "interfaces/subscriber.hpp"
-
#include "engine/data/vector2.hpp"
#include <memory>
@@ -13,19 +10,18 @@ enum CursorEvent
};
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
-class ICursorController : public IPublisher<CursorEvent, Vector2>
+class ICursorController
{
public:
using Event = CursorEvent;
using Context = Vector2;
- using Subscriber = std::shared_ptr<ISubscriber<Context>>;
- ~ICursorController() noexcept override = default;
+ virtual ~ICursorController() noexcept = default;
virtual void move(const Vector2 &direction, const uint32_t &amount) noexcept = 0;
// NOLINTNEXTLINE(google-default-arguments)
- virtual void move_to(const Vector2 &position, bool silent = false) noexcept = 0;
+ virtual void move_to(const Vector2 &position) noexcept = 0;
[[nodiscard]] virtual auto where() const noexcept -> Vector2 = 0;
@@ -34,10 +30,4 @@ public:
virtual void hide() noexcept = 0;
virtual void show() noexcept = 0;
-
- void
- subscribe(const Event &event, const Subscriber &subscriber) noexcept override = 0;
-
- void notify_subscribers(const Event &event, const Context &context)
- const noexcept override = 0;
};
diff --git a/src/interfaces/game.hpp b/src/interfaces/game.hpp
index 3aac6a9..e205fae 100644
--- a/src/interfaces/game.hpp
+++ b/src/interfaces/game.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include "interfaces/command.hpp"
#include "interfaces/cursor.hpp"
#include "interfaces/input.hpp"
#include "interfaces/scene.hpp"
diff --git a/src/interfaces/input.hpp b/src/interfaces/input.hpp
index 8239e48..0797c0d 100644
--- a/src/interfaces/input.hpp
+++ b/src/interfaces/input.hpp
@@ -1,8 +1,5 @@
#pragma once
-#include "interfaces/publisher.hpp"
-#include "interfaces/subscriber.hpp"
-
#include <cstddef>
#include <memory>
diff --git a/src/interfaces/publisher.hpp b/src/interfaces/publisher.hpp
deleted file mode 100644
index 2c47c34..0000000
--- a/src/interfaces/publisher.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#include "interfaces/subscriber.hpp"
-
-#include <functional>
-#include <memory>
-
-template <typename Event, typename Context>
-// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
-class IPublisher
-{
-public:
- virtual ~IPublisher() noexcept = default;
-
- virtual void subscribe(
- const Event &event,
- const std::shared_ptr<ISubscriber<Context>> &subscriber) noexcept = 0;
-
- virtual void
- notify_subscribers(const Event &event, const Context &context) const noexcept = 0;
-};
diff --git a/src/interfaces/statusline_subscriber_adapter.hpp b/src/interfaces/statusline_subscriber_adapter.hpp
deleted file mode 100644
index 925341f..0000000
--- a/src/interfaces/statusline_subscriber_adapter.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include "interfaces/status_manager.hpp"
-#include "interfaces/statusline.hpp"
-#include "interfaces/subscriber.hpp"
-
-#include <yacppdic/factory.hpp>
-
-#include <memory>
-#include <vector>
-
-template <typename Context>
-using IStatusLineSubscriberAdapterFactory =
- yacppdic::Factory<std::unique_ptr<ISubscriber<Context>>(
- const std::shared_ptr<IStatusManager> &status_manager,
- std::vector<StatusLineSection> sections)>;
diff --git a/src/interfaces/subscriber.hpp b/src/interfaces/subscriber.hpp
deleted file mode 100644
index 942c1d5..0000000
--- a/src/interfaces/subscriber.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-template <typename Context>
-// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
-class ISubscriber
-{
-public:
- virtual ~ISubscriber() = default;
-
- virtual void update(const Context &context) noexcept = 0;
-};