#pragma once #include #include #include "resource.h" #include "constants.h" #include "resource_fabricator.h" enum class asset_type{ TEXTURE, SPRITESHEET, AUDIO, MAP, UNKNOWN, }; using namespace crepe; class ResourceManager{ public: ResourceManager(); ~ResourceManager(); template T* Load(const Constants::FILE_PATH& file_path){ if (m_resources.find(file_path) != m_resources.end()) { return static_cast(m_resources[file_path]); } Resource* resource = ResourceFactory::create_resource(file_path); if (resource) { m_resources[file_path] = std::move(resource); } return static_cast(m_resources[file_path]); } void Unload(const Constants::FILE_PATH& file_path); private: std::unordered_map m_resources; };