b746578bc8
Sustituye en bloque las cabeceras de los archivos por una sola línea de copyright. Cero rastro de "Visente", "Sergi" o "1999" en el árbol del proyecto. Se eliminan también las variantes "© 2025 Port a C++20", "© 2025 Port a C++20 con SDL3" y "© 2025 Orni Attack" (con todas sus colas descriptivas como "Arquitectura de entidades" o "Sistema de física"), que en este punto eran ruido histórico. Aplicado con un par de sed (find -type f, excluyendo source/external y source/legacy): 1. \|^// © 1999 Visente i Sergi (versión Pascal)$|d 2. s|^// © 2025 (Port a C++20.*|Orni Attack.*)$|// © 2026 JailDesigner| Verificado: la única variante de cabecera tras el sweep es "// © 2026 JailDesigner". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
// shape_loader.hpp - Carregador estàtic de formes con caché
|
|
// © 2026 JailDesigner
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
#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 std::shared_ptr<Shape> 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<std::string, std::shared_ptr<Shape>> cache_;
|
|
static std::string base_path_; // "data/shapes/"
|
|
|
|
// Helpers privats
|
|
static std::string resolve_path(const std::string& filename);
|
|
};
|
|
|
|
} // namespace Graphics
|