i per fi ja comença a tornar tot a la normalitat
This commit is contained in:
@@ -9,17 +9,15 @@
|
||||
#include <vector> // for vector
|
||||
#include "asset.h" // for Asset
|
||||
#include "screen.h"
|
||||
#include "gif.h" // for LoadGif, LoadPalette
|
||||
#include "gif.h" // for LoadGif, LoadPalette
|
||||
|
||||
// Constructor
|
||||
Surface::Surface(std::shared_ptr<Surface> surface_dest, int w, int h)
|
||||
: surface_dest_(surface_dest),
|
||||
surface_data_(std::make_shared<SurfaceData>(w, h)),
|
||||
transparent_color_(0){}
|
||||
Surface::Surface(int w, int h)
|
||||
: surface_data_(std::make_shared<SurfaceData>(w, h)),
|
||||
transparent_color_(0) {}
|
||||
|
||||
Surface::Surface(std::shared_ptr<Surface> surface_dest, const std::string &file_path)
|
||||
: surface_dest_(surface_dest),
|
||||
transparent_color_(0)
|
||||
Surface::Surface(const std::string &file_path)
|
||||
: transparent_color_(0)
|
||||
{
|
||||
SurfaceData loadedData = loadSurface(file_path);
|
||||
surface_data_ = std::make_shared<SurfaceData>(std::move(loadedData));
|
||||
@@ -209,7 +207,7 @@ void Surface::render(int dx, int dy, int sx, int sy, int w, int h)
|
||||
void Surface::render(int x, int y, SDL_Rect *srcRect, SDL_RendererFlip flip)
|
||||
{
|
||||
auto surface_data = Screen::get()->getRendererSurface()->getSurfaceData();
|
||||
|
||||
|
||||
// Determina la región de origen (clip) a renderizar
|
||||
int sx = (srcRect) ? srcRect->x : 0;
|
||||
int sy = (srcRect) ? srcRect->y : 0;
|
||||
@@ -349,7 +347,7 @@ void Surface::renderWithColorReplace(int x, int y, Uint8 source_color, Uint8 tar
|
||||
// Vuelca la superficie a una textura
|
||||
void Surface::copyToTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
{
|
||||
if (!renderer || !texture)
|
||||
if (!renderer || !texture || !surface_data_)
|
||||
{
|
||||
throw std::runtime_error("Renderer or texture is null.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user