#include #include #include #include "ResourceManager.h" #include "Renderer.h" #include "Texture2D.h" #include "Font.h" void dae::ResourceManager::Init(const std::string& dataPath) { m_dataPath = dataPath; if (TTF_Init() != 0) { throw std::runtime_error(std::string("Failed to load support for fonts: ") + SDL_GetError()); } } std::shared_ptr dae::ResourceManager::LoadTexture(const std::string& file) const { const auto fullPath = m_dataPath + file; auto texture = IMG_LoadTexture(Renderer::GetInstance().GetSDLRenderer(), fullPath.c_str()); if (texture == nullptr) { throw std::runtime_error(std::string("Failed to load texture: ") + SDL_GetError()); } return std::make_shared(texture); } std::shared_ptr dae::ResourceManager::LoadFont(const std::string& file, unsigned int size) const { return std::make_shared(m_dataPath + file, size); }