De moment ja compila i executa, encara que no troba alguns fitxers
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <string> // Para char_traits, operator<<, operator+
|
||||
#include <vector> // Para vector
|
||||
#include "gif.c" // Para LoadGif, LoadPalette
|
||||
#include "stb_image.h" // Para stbi_image_free, stbi_load, STBI_rgb_a...
|
||||
#include "utils.h" // Para getFileName, printWithDots
|
||||
|
||||
@@ -32,7 +31,7 @@ Texture::Texture(SDL_Renderer *renderer, const std::string &path)
|
||||
}
|
||||
|
||||
// .gif
|
||||
else if (extension == "gif")
|
||||
/*else if (extension == "gif")
|
||||
{
|
||||
// Crea la surface desde un fichero
|
||||
surface_ = loadSurface(path_);
|
||||
@@ -45,7 +44,7 @@ Texture::Texture(SDL_Renderer *renderer, const std::string &path)
|
||||
createBlank(width_, height_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING);
|
||||
SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND);
|
||||
flipSurface();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ Texture::Texture(SDL_Renderer *renderer, const std::string &path)
|
||||
Texture::~Texture()
|
||||
{
|
||||
unloadTexture();
|
||||
unloadSurface();
|
||||
//unloadSurface();
|
||||
palettes_.clear();
|
||||
}
|
||||
|
||||
@@ -240,15 +239,15 @@ SDL_Texture *Texture::getSDLTexture()
|
||||
}
|
||||
|
||||
// Desencadenar la superficie actual
|
||||
void Texture::unloadSurface()
|
||||
/*void Texture::unloadSurface()
|
||||
{
|
||||
surface_.reset(); // Resetea el shared_ptr
|
||||
width_ = 0;
|
||||
height_ = 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Crea una surface desde un fichero .gif
|
||||
std::shared_ptr<Surface> Texture::loadSurface(const std::string &file_path)
|
||||
/*std::shared_ptr<Surface> Texture::loadSurface(const std::string &file_path)
|
||||
{
|
||||
// Desencadenar la superficie actual
|
||||
unloadSurface();
|
||||
@@ -293,10 +292,10 @@ std::shared_ptr<Surface> Texture::loadSurface(const std::string &file_path)
|
||||
height_ = h;
|
||||
|
||||
return surface;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Vuelca la surface en la textura
|
||||
void Texture::flipSurface()
|
||||
/*void Texture::flipSurface()
|
||||
{
|
||||
// Limpia la textura
|
||||
auto temp = SDL_GetRenderTarget(renderer_);
|
||||
@@ -314,16 +313,16 @@ void Texture::flipSurface()
|
||||
pixels[i] = palettes_[current_palette_][surface_->data[i]];
|
||||
}
|
||||
SDL_UnlockTexture(texture_);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Establece un color de la paleta
|
||||
void Texture::setPaletteColor(int palette, int index, Uint32 color)
|
||||
/*void Texture::setPaletteColor(int palette, int index, Uint32 color)
|
||||
{
|
||||
palettes_.at(palette)[index] = color;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Carga una paleta desde un fichero
|
||||
std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
||||
/*std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
||||
{
|
||||
std::vector<Uint32> palette;
|
||||
|
||||
@@ -360,10 +359,10 @@ std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
||||
}
|
||||
|
||||
return palette;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Añade una paleta a la lista
|
||||
void Texture::addPaletteFromFile(const std::string &path)
|
||||
/*void Texture::addPaletteFromFile(const std::string &path)
|
||||
{
|
||||
palettes_.emplace_back(loadPaletteFromFile(path));
|
||||
setPaletteColor((int)palettes_.size() - 1, 0, 0x00000000);
|
||||
@@ -377,7 +376,7 @@ void Texture::setPalette(int palette)
|
||||
current_palette_ = palette;
|
||||
flipSurface();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Obtiene el renderizador
|
||||
SDL_Renderer *Texture::getRenderer()
|
||||
|
||||
Reference in New Issue
Block a user