Arreglos en la estructura i format del codi

This commit is contained in:
2025-03-01 19:33:40 +01:00
parent 31cded15cc
commit 5c371e7517
12 changed files with 98 additions and 202 deletions

View File

@@ -15,12 +15,10 @@ Surface::Surface(std::shared_ptr<SurfaceData> surface_dest, int w, int h)
surface_(std::make_shared<SurfaceData>(w, h)),
transparent_color_(0) {}
Surface::Surface(std::shared_ptr<SurfaceData> surface_dest, std::string file_path)
Surface::Surface(std::shared_ptr<SurfaceData> surface_dest, const std::string &file_path)
: surface_dest_(surface_dest),
surface_(std::make_shared<SurfaceData>(loadSurface(Asset::get()->get(file_path)))),
transparent_color_(0) {
std::cout << "surface loaded: "<< surface_->width << "x" << surface_->height << std::endl;
}
transparent_color_(0) {}
Surface::~Surface() {}
@@ -137,7 +135,7 @@ void Surface::render(int dx, int dy, int sx, int sy, int w, int h)
{
throw std::runtime_error("Surface source or destination is null.");
}
// Limitar la región para evitar accesos fuera de rango
w = std::min(w, surface_->width - sx);
h = std::min(h, surface_->height - sy);