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