fix: s'havien fotut els dos finals, pero ja estan corregits

This commit is contained in:
2025-03-02 13:43:23 +01:00
parent cdf0b0a694
commit 0d74a8a29f
15 changed files with 214 additions and 277 deletions

View File

@@ -1,16 +1,16 @@
#include "utils.h"
#include <stdlib.h> // for abs
#include <algorithm> // for find, transform
#include <cctype> // for tolower
#include <cmath> // for round, abs
#include <exception> // for exception
#include <filesystem> // for path
#include <iostream> // for basic_ostream, cout, basic_ios, ios, endl
#include <string> // for basic_string, string, char_traits, allocator
#include <unordered_map> // for unordered_map, operator==, _Node_const_iter...
#include <utility> // for pair
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_PlayMusic
#include "resource.h" // for Resource
#include <stdlib.h> // for abs
#include <algorithm> // for find, transform
#include <cctype> // for tolower
#include <cmath> // for round, abs
#include <exception> // for exception
#include <filesystem> // for path
#include <iostream> // for basic_ostream, cout, basic_ios, ios, endl
#include <string> // for basic_string, string, char_traits, allocator
#include <unordered_map> // for unordered_map, operator==, _Node_const_iter...
#include <utility> // for pair
#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_PlayMusic
#include "resource.h" // for Resource
// Calcula el cuadrado de la distancia entre dos puntos
double distanceSquared(int x1, int y1, int x2, int y2)
@@ -551,3 +551,21 @@ void fillTextureWithColor(SDL_Renderer *renderer, SDL_Texture *texture, Uint8 r,
// Restaurar el render target previo
SDL_SetRenderTarget(renderer, previous_target);
}
// Crea un SDL_Texture
SDL_Texture *createTexture(SDL_Renderer *renderer, int width, int height, Uint32 format, int access, bool logError)
{
// Crear la textura
SDL_Texture *texture = SDL_CreateTexture(renderer, format, access, width, height);
if (texture == nullptr)
{
// Registrar el error si está habilitado
if (logError)
{
std::cerr << "Error: Texture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
}
return nullptr;
}
return texture;
}