#pragma once #include #include #include #include "core/resources/resource_types.hpp" namespace Resource { // Cache mínim per a la fase 2: només surfaces i animacions, càrrega // explícita per nom + path. Per ara la cerca és lineal sobre vector. // Meyers singleton: la destrucció estàtica només toca smart pointers, no // depén d'SDL ni de Screen, així que és segura sense ordenació explícita. class Cache { public: static auto get() -> Cache&; Cache(const Cache&) = delete; Cache(Cache&&) = delete; auto operator=(const Cache&) -> Cache& = delete; auto operator=(Cache&&) -> Cache& = delete; // Carrega una surface des de fitxer i la registra amb el nom donat. void loadSurface(const std::string& name, const std::string& file_path); // Llig el YAML d'animació en cru i el registra amb el nom donat. void loadAnimation(const std::string& name, const std::string& file_path); auto getSurface(const std::string& name) -> std::shared_ptr; auto getAnimationData(const std::string& name) -> const AnimationResource&; private: Cache() = default; ~Cache() = default; std::vector surfaces_; std::vector animations_; }; } // namespace Resource