aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/Mediator.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-28 10:13:11 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-28 10:13:11 +0100
commit6fd7cec7d4bbf5aeb361b3f1337671bb0f9af61b (patch)
tree01f6977c66a1e07e07aae42358a7e1a4e55ef53c /src/crepe/manager/Mediator.h
parentd1eed940b8119e95a14f1d08bf26184c7f0a0d8f (diff)
manager mediator refactor
Diffstat (limited to 'src/crepe/manager/Mediator.h')
-rw-r--r--src/crepe/manager/Mediator.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/crepe/manager/Mediator.h b/src/crepe/manager/Mediator.h
new file mode 100644
index 0000000..ce35d5c
--- /dev/null
+++ b/src/crepe/manager/Mediator.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "../util/OptionalRef.h"
+
+// TODO: remove these singletons:
+#include "SaveManager.h"
+#include "EventManager.h"
+
+namespace crepe {
+
+class ComponentManager;
+class SceneManager;
+
+/**
+ * Struct to pass references to classes that would otherwise need to be singletons down to
+ * other classes within the engine hierarchy. Made to prevent constant changes to subclasses to
+ * pass specific references through dependency injection. All references on this struct
+ * *should* be explicitly checked for availability as this struct does not guarantee anything.
+ *
+ * \todo Find better solution
+ */
+struct Mediator {
+ OptionalRef<ComponentManager> component_manager;
+ OptionalRef<SceneManager> scene_manager;
+ OptionalRef<SaveManager> save_manager = SaveManager::get_instance();
+ OptionalRef<EventManager> event_manager = EventManager::get_instance();
+};
+
+}