aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 14:29:25 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-12-08 14:29:25 +0100
commit63bcd54e0e0ea64cfef5950568b4253d5dae5c1e (patch)
tree24f1f251259ca46566a4694b765dc4e99ee264ab /src/crepe/manager
parent5c3ce63558f2d5dec06a124773f910d783bb22aa (diff)
removed singleton from SDLContext, problem now is cannot call functionalities in the constructor sprite and animator and texture because it can only be filled at rendersystem call
Diffstat (limited to 'src/crepe/manager')
-rw-r--r--src/crepe/manager/EventManager.cpp2
-rw-r--r--src/crepe/manager/Mediator.h4
-rw-r--r--src/crepe/manager/ResourceManager.cpp2
-rw-r--r--src/crepe/manager/SceneManager.cpp3
4 files changed, 8 insertions, 3 deletions
diff --git a/src/crepe/manager/EventManager.cpp b/src/crepe/manager/EventManager.cpp
index 20f0dd3..17fe528 100644
--- a/src/crepe/manager/EventManager.cpp
+++ b/src/crepe/manager/EventManager.cpp
@@ -1,9 +1,11 @@
#include "EventManager.h"
+#include "util/Log.h"
using namespace crepe;
using namespace std;
EventManager & EventManager::get_instance() {
+ dbg_trace();
static EventManager instance;
return instance;
}
diff --git a/src/crepe/manager/Mediator.h b/src/crepe/manager/Mediator.h
index ba0b41f..6a9e113 100644
--- a/src/crepe/manager/Mediator.h
+++ b/src/crepe/manager/Mediator.h
@@ -3,7 +3,6 @@
#include "../util/OptionalRef.h"
// TODO: remove these singletons:
-#include "../facade/SDLContext.h"
#include "EventManager.h"
#include "SaveManager.h"
#include "api/LoopTimer.h"
@@ -13,6 +12,7 @@ namespace crepe {
class ComponentManager;
class SceneManager;
class ResourceManager;
+class SDLContext;
/**
* Struct to pass references to classes that would otherwise need to be singletons down to
@@ -27,12 +27,12 @@ class ResourceManager;
* \warning This class should never be directly accessible from the API
*/
struct Mediator {
+ OptionalRef<SDLContext> sdl_context;
OptionalRef<ComponentManager> component_manager;
OptionalRef<SceneManager> scene_manager;
OptionalRef<SaveManager> save_manager = SaveManager::get_instance();
OptionalRef<EventManager> event_manager = EventManager::get_instance();
OptionalRef<ResourceManager> resource_manager;
- OptionalRef<SDLContext> sdl_context = SDLContext::get_instance();
OptionalRef<LoopTimer> timer = LoopTimer::get_instance();
};
diff --git a/src/crepe/manager/ResourceManager.cpp b/src/crepe/manager/ResourceManager.cpp
index 7c01808..a141a46 100644
--- a/src/crepe/manager/ResourceManager.cpp
+++ b/src/crepe/manager/ResourceManager.cpp
@@ -6,8 +6,8 @@ using namespace crepe;
using namespace std;
ResourceManager::ResourceManager(Mediator & mediator) : Manager(mediator) {
- mediator.resource_manager = *this;
dbg_trace();
+ mediator.resource_manager = *this;
}
ResourceManager::~ResourceManager() { dbg_trace(); }
diff --git a/src/crepe/manager/SceneManager.cpp b/src/crepe/manager/SceneManager.cpp
index 50a9fbb..a788c51 100644
--- a/src/crepe/manager/SceneManager.cpp
+++ b/src/crepe/manager/SceneManager.cpp
@@ -4,10 +4,13 @@
#include "ComponentManager.h"
#include "SceneManager.h"
+#include "util/Log.h"
+
using namespace crepe;
using namespace std;
SceneManager::SceneManager(Mediator & mediator) : Manager(mediator) {
+ dbg_trace();
mediator.scene_manager = *this;
}