migracio a SDL3

This commit is contained in:
2026-04-03 10:04:49 +02:00
parent 1e73a3159f
commit 7e570e2814
44 changed files with 826 additions and 801 deletions

View File

@@ -1,8 +1,5 @@
#include "title.h"
#include <SDL2/SDL_error.h> // for SDL_GetError
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <SDL2/SDL_video.h> // for SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLS...
#include <SDL3/SDL.h>
#include <stdlib.h> // for rand
#include <iostream> // for basic_ostream, operator<<, basic_ostrea...
#include <string> // for basic_string, operator+, char_traits
@@ -12,7 +9,7 @@
#include "fade.h" // for Fade
#include "game.h" // for Game
#include "input.h" // for Input, INPUT_USE_GAMECONTROLLER, INPUT_...
#include "jail_audio.h" // for JA_StopMusic, JA_GetMusicState, JA_Play...
#include "jail_audio.hpp" // for JA_StopMusic, JA_GetMusicState, JA_Play...
#include "lang.h" // for Lang, ba_BA, en_UK, es_ES
#include "menu.h" // for Menu
#include "screen.h" // for Screen, FILTER_LINEAL, FILTER_NEAREST
@@ -231,6 +228,9 @@ void Title::init()
// Actualiza las variables del objeto
void Title::update()
{
// Actualiza el audio
JA_Update();
// Comprueba las entradas
checkInput();
@@ -562,7 +562,7 @@ void Title::render()
screen->clean(bgColor);
// Dibuja el tileado de fondo
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
{ SDL_FRect fSrc = {(float)backgroundWindow.x, (float)backgroundWindow.y, (float)backgroundWindow.w, (float)backgroundWindow.h}; SDL_RenderTexture(renderer, background, &fSrc, nullptr); };
// Dibuja el degradado
gradient->render();
@@ -594,7 +594,7 @@ void Title::render()
screen->clean(bgColor);
// Dibuja el tileado de fondo
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
{ SDL_FRect fSrc = {(float)backgroundWindow.x, (float)backgroundWindow.y, (float)backgroundWindow.w, (float)backgroundWindow.h}; SDL_RenderTexture(renderer, background, &fSrc, nullptr); };
// Dibuja el degradado
gradient->render();
@@ -628,7 +628,7 @@ void Title::render()
screen->clean(bgColor);
// Dibuja el tileado de fondo
SDL_RenderCopy(renderer, background, &backgroundWindow, nullptr);
{ SDL_FRect fSrc = {(float)backgroundWindow.x, (float)backgroundWindow.y, (float)backgroundWindow.w, (float)backgroundWindow.h}; SDL_RenderTexture(renderer, background, &fSrc, nullptr); };
// Dibuja el degradado
gradient->render();
@@ -678,20 +678,20 @@ void Title::checkEvents()
while (SDL_PollEvent(eventHandler) != 0)
{
// Evento de salida de la aplicación
if (eventHandler->type == SDL_QUIT)
if (eventHandler->type == SDL_EVENT_QUIT)
{
section->name = SECTION_PROG_QUIT;
break;
}
else if (eventHandler->type == SDL_RENDER_DEVICE_RESET || eventHandler->type == SDL_RENDER_TARGETS_RESET)
else if (eventHandler->type == SDL_EVENT_RENDER_DEVICE_RESET || eventHandler->type == SDL_EVENT_RENDER_TARGETS_RESET)
{
reLoadTextures();
}
if (section->subsection == SUBSECTION_TITLE_3)
{ // Si se pulsa alguna tecla durante la tercera sección del titulo
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
if ((eventHandler->type == SDL_EVENT_KEY_UP) || (eventHandler->type == SDL_EVENT_JOYSTICK_BUTTON_UP))
{
// Muestra el menu
menuVisible = true;
@@ -752,9 +752,6 @@ void Title::switchFullScreenModeVar()
options->videoMode = SDL_WINDOW_FULLSCREEN;
break;
case SDL_WINDOW_FULLSCREEN:
options->videoMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
break;
case SDL_WINDOW_FULLSCREEN_DESKTOP:
options->videoMode = 0;
break;
@@ -883,10 +880,6 @@ void Title::updateMenuLabels()
menu.options->setItemCaption(i, lang->getText(5)); // FULLSCREEN
break;
case SDL_WINDOW_FULLSCREEN_DESKTOP:
menu.options->setItemCaption(i, lang->getText(6)); // FAKE FULLSCREEN
break;
default:
menu.options->setItemCaption(i, lang->getText(4)); // WINDOW
break;