// shape_loader.hpp - Carregador estàtic de formes amb caché // © 2025 Port a C++20 amb SDL3 #pragma once #include #include #include #include "core/graphics/shape.hpp" namespace Graphics { // Carregador estàtic de formes amb caché class ShapeLoader { public: // No instanciable (tot estàtic) ShapeLoader() = delete; // Carregar shape des de fitxer (amb caché) // Retorna punter compartit (nullptr si error) // Exemple: load("ship.shp") → busca a "data/shapes/ship.shp" static std::shared_ptr load(const std::string& filename); // Netejar caché (útil per debug/recàrrega) static void clear_cache(); // Estadístiques (debug) static size_t get_cache_size(); private: static std::unordered_map> cache_; static std::string base_path_; // "data/shapes/" // Helpers privats static std::string resolve_path(const std::string& filename); }; } // namespace Graphics