corregides les textures amb filtre linear
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include "lang.h" // for Lang, MAX_LANGUAGES, ba_BA, en_UK
|
#include "lang.h" // for Lang, MAX_LANGUAGES, ba_BA, en_UK
|
||||||
#include "logo.h" // for Logo
|
#include "logo.h" // for Logo
|
||||||
#include "screen.h" // for FILTER_NEAREST, Screen, FILTER_...
|
#include "screen.h" // for FILTER_NEAREST, Screen, FILTER_...
|
||||||
|
#include "texture.h" // for Texture
|
||||||
#include "title.h" // for Title
|
#include "title.h" // for Title
|
||||||
#include "utils.h" // for options_t, input_t, boolToString
|
#include "utils.h" // for options_t, input_t, boolToString
|
||||||
|
|
||||||
@@ -68,6 +69,9 @@ Director::Director(int argc, const char *argv[])
|
|||||||
// Inicializa JailAudio
|
// Inicializa JailAudio
|
||||||
initJailAudio();
|
initJailAudio();
|
||||||
|
|
||||||
|
// Establece el modo de escalado de texturas
|
||||||
|
Texture::setGlobalScaleMode(options->filter == FILTER_NEAREST ? SDL_SCALEMODE_NEAREST : SDL_SCALEMODE_LINEAR);
|
||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
lang = new Lang(asset);
|
lang = new Lang(asset);
|
||||||
lang->setLang(options->language);
|
lang->setLang(options->language);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct options_t;
|
|||||||
struct section_t;
|
struct section_t;
|
||||||
|
|
||||||
// Textos
|
// Textos
|
||||||
constexpr const char* WINDOW_CAPTION = "Coffee Crisis";
|
constexpr const char* WINDOW_CAPTION = "© 2020 Coffee Crisis — JailDesigner";
|
||||||
|
|
||||||
class Director
|
class Director
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ Fade::Fade(SDL_Renderer *renderer)
|
|||||||
mRenderer = renderer;
|
mRenderer = renderer;
|
||||||
|
|
||||||
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
mBackbuffer = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||||
|
if (mBackbuffer != nullptr)
|
||||||
|
{
|
||||||
|
SDL_SetTextureScaleMode(mBackbuffer, SDL_SCALEMODE_NEAREST);
|
||||||
|
}
|
||||||
if (mBackbuffer == nullptr)
|
if (mBackbuffer == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset,
|
|||||||
|
|
||||||
// Crea un backbuffer para el renderizador
|
// Crea un backbuffer para el renderizador
|
||||||
backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
backbuffer = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||||
if (backbuffer == nullptr)
|
if (backbuffer != nullptr)
|
||||||
|
{
|
||||||
|
SDL_SetTextureScaleMode(backbuffer, Texture::currentScaleMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options
|
|||||||
|
|
||||||
// Crea la textura donde se dibujan los graficos del juego
|
// Crea la textura donde se dibujan los graficos del juego
|
||||||
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
||||||
|
if (gameCanvas != nullptr)
|
||||||
|
{
|
||||||
|
SDL_SetTextureScaleMode(gameCanvas, options->filter == FILTER_NEAREST ? SDL_SCALEMODE_NEAREST : SDL_SCALEMODE_LINEAR);
|
||||||
|
}
|
||||||
if (gameCanvas == nullptr)
|
if (gameCanvas == nullptr)
|
||||||
{
|
{
|
||||||
if (options->console)
|
if (options->console)
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "stb_image.h" // for stbi_failure_reason, stbi_image_free
|
#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
|
// Constructor
|
||||||
Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose)
|
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
|
// Obtiene las dimensiones de la imagen
|
||||||
this->width = loadedSurface->w;
|
this->width = loadedSurface->w;
|
||||||
this->height = loadedSurface->h;
|
this->height = loadedSurface->h;
|
||||||
|
|
||||||
|
// Aplica el modo de escalado
|
||||||
|
SDL_SetTextureScaleMode(newTexture, currentScaleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elimina la textura cargada
|
// Elimina la textura cargada
|
||||||
@@ -121,6 +131,7 @@ bool Texture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_Tex
|
|||||||
{
|
{
|
||||||
this->width = width;
|
this->width = width;
|
||||||
this->height = height;
|
this->height = height;
|
||||||
|
SDL_SetTextureScaleMode(texture, currentScaleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return texture != nullptr;
|
return texture != nullptr;
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ private:
|
|||||||
std::string path; // Ruta de la imagen de la textura
|
std::string path; // Ruta de la imagen de la textura
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static SDL_ScaleMode currentScaleMode; // Modo de escalado global para nuevas texturas
|
||||||
|
|
||||||
|
// Establece el modo de escalado global para nuevas texturas
|
||||||
|
static void setGlobalScaleMode(SDL_ScaleMode mode);
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Texture(SDL_Renderer *renderer, std::string path = "", bool verbose = false);
|
Texture(SDL_Renderer *renderer, std::string path = "", bool verbose = false);
|
||||||
|
|
||||||
|
|||||||
@@ -473,6 +473,8 @@ void Title::update()
|
|||||||
options->filter = FILTER_NEAREST;
|
options->filter = FILTER_NEAREST;
|
||||||
else
|
else
|
||||||
options->filter = FILTER_LINEAL;
|
options->filter = FILTER_LINEAL;
|
||||||
|
Texture::setGlobalScaleMode(options->filter == FILTER_NEAREST ? SDL_SCALEMODE_NEAREST : SDL_SCALEMODE_LINEAR);
|
||||||
|
reLoadTextures();
|
||||||
updateMenuLabels();
|
updateMenuLabels();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1058,6 +1060,10 @@ void Title::createTiledBackground()
|
|||||||
{
|
{
|
||||||
// Crea la textura para el mosaico de fondo
|
// Crea la textura para el mosaico de fondo
|
||||||
background = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH * 2, GAMECANVAS_HEIGHT * 2);
|
background = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH * 2, GAMECANVAS_HEIGHT * 2);
|
||||||
|
if (background != nullptr)
|
||||||
|
{
|
||||||
|
SDL_SetTextureScaleMode(background, Texture::currentScaleMode);
|
||||||
|
}
|
||||||
if (background == nullptr)
|
if (background == nullptr)
|
||||||
{
|
{
|
||||||
if (options->console)
|
if (options->console)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct JA_Music_t;
|
|||||||
struct JA_Sound_t;
|
struct JA_Sound_t;
|
||||||
|
|
||||||
// Textos
|
// Textos
|
||||||
constexpr const char *TEXT_COPYRIGHT = "@2020,2023 JailDesigner (v2.3.2)";
|
constexpr const char *TEXT_COPYRIGHT = "@2020 JailDesigner (v2.3.3)";
|
||||||
|
|
||||||
// Contadores
|
// Contadores
|
||||||
constexpr int TITLE_COUNTER = 800;
|
constexpr int TITLE_COUNTER = 800;
|
||||||
|
|||||||
Reference in New Issue
Block a user