corregides les textures amb filtre linear

This commit is contained in:
2026-04-03 10:20:26 +02:00
parent 7e570e2814
commit 8f1aeadeee
9 changed files with 41 additions and 3 deletions

View File

@@ -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;