27 virtual void Init()
override;
31 template<
class T,
class ...ARGS>
56 template<
class T,
class ...ARGS>
59 typedef std::map<Fling::Guid_Handle, std::shared_ptr<Resource>>::iterator
ResourceMapIt;
60 typedef std::map<Fling::Guid_Handle, std::shared_ptr<Resource>>::const_iterator
ResourceMapConstIt;
67 template<
class T,
class ...ARGS>
71 if (std::shared_ptr<T> Existing = GetResourceOfType<T>(t_ID))
78 std::shared_ptr<Resource> NewResource = std::make_shared<T>(t_ID, std::forward<ARGS>(args)...);
82 return std::static_pointer_cast<T>( NewResource );
88 if (std::shared_ptr<Resource> Res =
GetResource(t_ID))
90 return std::static_pointer_cast<T>(Res);
std::map< Fling::Guid_Handle, std::shared_ptr< Resource > > m_ResourceMap
Map of currently loaded resources.
Definition: ResourceManager.h:63
std::shared_ptr< T > LoadResourceImpl(Guid t_ID, ARGS &&... args)
Definition: ResourceManager.h:68
std::shared_ptr< T > GetResourceOfType(Guid_Handle t_ID) const
Definition: ResourceManager.h:86
static std::shared_ptr< T > LoadResource(Guid t_ID, ARGS &&... args)
Definition: ResourceManager.h:32
entt::hashed_string::hash_type Guid_Handle
Definition: FlingTypes.h:22
Class that can have only one instance.
Definition: Singleton.hpp:11
std::map< Fling::Guid_Handle, std::shared_ptr< Resource > >::const_iterator ResourceMapConstIt
Definition: ResourceManager.h:60
std::shared_ptr< Resource > GetResource(Guid_Handle t_ID) const
Get the already loaded resouce with this Guid.
Definition: ResourceManager.cpp:33
std::map< Fling::Guid_Handle, std::shared_ptr< Resource > >::iterator ResourceMapIt
Definition: ResourceManager.h:59
entt::hashed_string Guid
Definition: FlingTypes.h:21
The resource manager handles loading of files off disk.
Definition: ResourceManager.h:23
static ResourceManager & Get()
Definition: Singleton.hpp:36
virtual void Init() override
Definition: ResourceManager.cpp:6
bool IsLoaded(Guid_Handle t_ID) const
Check if there is a resource with this ID loaded or not.
Definition: ResourceManager.cpp:44
virtual void Shutdown() override
Definition: ResourceManager.cpp:26