diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 19:22:24 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 19:22:24 +0100 |
commit | 1d303f3a506dc7b6f68edb4af0a2043c4c53ab1e (patch) | |
tree | 6881feac4996da15834e85fb56ea3f9d84285189 /src/crepe/manager | |
parent | 37f352c20cdf3c972ad99b076bb091f698132312 (diff) | |
parent | 30c17c98e54c1534664de08ca3838c40c859d166 (diff) |
mege with master
Diffstat (limited to 'src/crepe/manager')
-rw-r--r-- | src/crepe/manager/Mediator.h | 7 | ||||
-rw-r--r-- | src/crepe/manager/ResourceManager.cpp | 2 | ||||
-rw-r--r-- | src/crepe/manager/ResourceManager.hpp | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/crepe/manager/Mediator.h b/src/crepe/manager/Mediator.h index b529f2c..a055bb9 100644 --- a/src/crepe/manager/Mediator.h +++ b/src/crepe/manager/Mediator.h @@ -2,9 +2,6 @@ #include "../util/OptionalRef.h" -// TODO: remove these singletons: -#include "../facade/SDLContext.h" - namespace crepe { class ComponentManager; @@ -13,6 +10,8 @@ class EventManager; class LoopTimerManager; 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 +26,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<EventManager> event_manager; OptionalRef<LoopTimerManager> loop_timer; OptionalRef<SaveManager> save_manager; OptionalRef<ResourceManager> resource_manager; - OptionalRef<SDLContext> sdl_context = SDLContext::get_instance(); }; } // 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) |