corregides les textures amb filtre linear
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h" // for stbi_failure_reason, stbi_image_free
|
||||
|
||||
SDL_ScaleMode Texture::currentScaleMode = SDL_SCALEMODE_NEAREST;
|
||||
|
||||
void Texture::setGlobalScaleMode(SDL_ScaleMode mode)
|
||||
{
|
||||
currentScaleMode = mode;
|
||||
}
|
||||
|
||||
// Constructor
|
||||
Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose)
|
||||
{
|
||||
@@ -96,6 +103,9 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbos
|
||||
// Obtiene las dimensiones de la imagen
|
||||
this->width = loadedSurface->w;
|
||||
this->height = loadedSurface->h;
|
||||
|
||||
// Aplica el modo de escalado
|
||||
SDL_SetTextureScaleMode(newTexture, currentScaleMode);
|
||||
}
|
||||
|
||||
// Elimina la textura cargada
|
||||
@@ -121,6 +131,7 @@ bool Texture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_Tex
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
SDL_SetTextureScaleMode(texture, currentScaleMode);
|
||||
}
|
||||
|
||||
return texture != nullptr;
|
||||
|
||||
Reference in New Issue
Block a user