gitignore no ha deixat versionar cap fitxer de core

afegida gestió de ratolí
This commit is contained in:
2025-12-03 09:42:45 +01:00
parent aa66dd41c1
commit 9f0dfc4e24
39 changed files with 2983 additions and 3 deletions
+39
View File
@@ -0,0 +1,39 @@
// shape_loader.hpp - Carregador estàtic de formes amb caché
// © 2025 Port a C++20 amb SDL3
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#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 forma 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<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