aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/manager')
-rw-r--r--src/crepe/manager/EventManager.cpp2
-rw-r--r--src/crepe/manager/Mediator.h8
-rw-r--r--src/crepe/manager/ResourceManager.cpp2
-rw-r--r--src/crepe/manager/ResourceManager.hpp2
-rw-r--r--src/crepe/manager/SceneManager.cpp3
5 files changed, 12 insertions, 5 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 35ac181..d5f7e00 100644
--- a/src/crepe/manager/Mediator.h
+++ b/src/crepe/manager/Mediator.h
@@ -3,8 +3,8 @@
#include "../util/OptionalRef.h"
// TODO: remove these singletons:
-#include "../facade/SDLContext.h"
#include "EventManager.h"
+#include "SaveManager.h"
#include "api/LoopTimer.h"
namespace crepe {
@@ -13,6 +13,8 @@ class ComponentManager;
class SceneManager;
class SaveManager;
class ResourceManager;
+class SDLContext;
+class LoopTimer;
/**
* Struct to pass references to classes that would otherwise need to be singletons down to
@@ -27,13 +29,13 @@ 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;
OptionalRef<EventManager> event_manager = EventManager::get_instance();
OptionalRef<ResourceManager> resource_manager;
- OptionalRef<SDLContext> sdl_context = SDLContext::get_instance();
- OptionalRef<LoopTimer> timer = LoopTimer::get_instance();
+ OptionalRef<LoopTimer> timer;
};
} // namespace crepe
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/ResourceManager.hpp b/src/crepe/manager/ResourceManager.hpp
index 5167d71..cf5c949 100644
--- a/src/crepe/manager/ResourceManager.hpp
+++ b/src/crepe/manager/ResourceManager.hpp
@@ -13,7 +13,7 @@ T & ResourceManager::get(const Asset & asset) {
"cache must recieve a derivative class of Resource");
CacheEntry & entry = this->get_entry(asset);
- if (entry.resource == nullptr) entry.resource = make_unique<T>(asset);
+ if (entry.resource == nullptr) entry.resource = make_unique<T>(asset, this->mediator);
T * concrete_resource = dynamic_cast<T *>(entry.resource.get());
if (concrete_resource == nullptr)
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;
}