migrant a SDL3

This commit is contained in:
2025-03-27 09:43:19 +01:00
parent d2286905dc
commit 2edb978a28
67 changed files with 234 additions and 283 deletions

View File

@@ -10,51 +10,42 @@ cmake_policy(SET CMP0072 NEW)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
# Configuración global de flags de compilación # Cargar todos los archivos fuente directamente desde el directorio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") file(GLOB SOURCES "${CMAKE_SOURCE_DIR}/source/*.cpp")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -ffunction-sections -fdata-sections")
# Define el directorio de los archivos fuente
set(DIR_SOURCES "${CMAKE_SOURCE_DIR}/source")
# Cargar todos los archivos fuente en DIR_SOURCES
file(GLOB SOURCES "${DIR_SOURCES}/*.cpp")
# Verificar si se encontraron archivos fuente # Verificar si se encontraron archivos fuente
if(NOT SOURCES) if(NOT SOURCES)
message(FATAL_ERROR "No se encontraron archivos fuente en ${DIR_SOURCES}. Verifica que el directorio existe y contiene archivos .cpp.") message(FATAL_ERROR "No se encontraron archivos fuente en ${CMAKE_SOURCE_DIR}/source. Verifica que el directorio existe y contiene archivos .cpp.")
endif() endif()
# Configuración de SDL3 (usando el método recomendado) # Configuración de SDL3 (usando el método recomendado)
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
message(STATUS "SDL3 encontrado: ${SDL3_INCLUDE_DIRS}") message(STATUS "SDL3 encontrado: ${SDL3_INCLUDE_DIRS}")
# Incluye los directorios si es necesario (SDL3::SDL3 ya incluye la información necesaria)
include_directories(${SDL3_INCLUDE_DIRS})
# Añadir ejecutable principal # Añadir ejecutable principal
add_executable(${PROJECT_NAME} ${SOURCES}) add_executable(${PROJECT_NAME} ${SOURCES})
# Configuración de flags de compilación
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:RELEASE>:-Os -ffunction-sections -fdata-sections>)
# Enlazar la librería SDL3 # Enlazar la librería SDL3
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3) target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3)
# Configuración común de salida de ejecutables en el directorio raíz
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
# Añadir definiciones de compilación dependiendo del tipo de build
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<CONFIG:DEBUG>:DEBUG VERBOSE>)
# Configuración específica para cada plataforma # Configuración específica para cada plataforma
if(WIN32) if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD) target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD)
target_link_libraries(${PROJECT_NAME} PRIVATE mingw32 opengl32) target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32 mingw32 opengl32)
elseif(APPLE) elseif(APPLE)
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD) target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated)
set(CMAKE_OSX_ARCHITECTURES "arm64") set(CMAKE_OSX_ARCHITECTURES "arm64")
elseif(UNIX AND NOT APPLE) elseif(UNIX AND NOT APPLE)
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD) target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
# Por ejemplo, si necesitas enlazar OpenGL: endif()
# Configuración común para OpenGL (excepto en Windows, ya configurado)
if(NOT WIN32)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
if(OPENGL_FOUND) if(OPENGL_FOUND)
message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}") message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}")
@@ -64,13 +55,7 @@ elseif(UNIX AND NOT APPLE)
endif() endif()
endif() endif()
# Añadir OpenGL a las bibliotecas enlazadas # Configuración común de salida de ejecutables en el directorio raíz
if(NOT WIN32) #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
find_package(OpenGL REQUIRED) # Especificar la ubicación del ejecutable (en la raíz del proyecto)
if(OPENGL_FOUND) set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}")
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
else()
message(FATAL_ERROR "OpenGL no encontrado")
endif()
endif()

View File

@@ -1,6 +1,5 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string

View File

@@ -1,9 +1,8 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <string> // Para string, basic_string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "utils.h" #include "utils.h" // Para getPath
enum class AssetType : int enum class AssetType : int
{ {

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
#include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer
@@ -7,9 +6,9 @@
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "utils.h" // Para Color #include "utils.h" // Para Color
class MovingSprite; // lines 7-7 class MovingSprite; // lines 10-10
class Sprite; // lines 8-8 class Sprite; // lines 11-11
class Texture; // lines 9-9 class Texture; // lines 12-12
/* /*
Esta clase es la encargada de dibujar el fondo que aparece durante la sección Esta clase es la encargada de dibujar el fondo que aparece durante la sección

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_stdinc.h> // Para Uint8, Uint16, Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint8, Uint16, Uint32

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE #include "balloon.h" // Para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
#include <vector> #include <vector>

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_stdinc.h> // Para Uint8 #include <SDL3/SDL_stdinc.h> // Para Uint8
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr

View File

@@ -1,27 +1,26 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "credits.h" #include "credits.h"
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND #include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_QUIT #include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888 #include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks #include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <algorithm> // Para max, min, clamp #include <algorithm> // Para max, min, clamp
#include <cstdlib> // Para abs #include <array> // Para array
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include <vector> // Para vector #include <vector> // Para vector
#include <array> // Para vector
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.h" // Para BalloonManager
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check
#include "global_inputs.h" // Para check, update #include "global_inputs.h" // Para check, update
#include "input.h" // Para Input #include "input.h" // Para Input, INPUT_ALLOW_REPEAT
#include "jail_audio.h" // Para JA_GetMusicState, JA_SetMusicVolume #include "jail_audio.h" // Para JA_GetMusicState, JA_SetMusicVolume
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "global_events.h" // Para handleEvent
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param
#include "player.h" // Para Player, PlayerState #include "player.h" // Para Player, PlayerState
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.h" // Para Name, name, Options, options #include "section.h" // Para Name, name
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW #include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW
#include "texture.h" // Para Texture #include "texture.h" // Para Texture

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Texture

View File

@@ -1,20 +1,19 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h> // Para SDL_ControllerButtonEvent #include <SDL3/SDL_events.h> // Para SDL_Event, SDL_GamepadButtonEvent
#include <SDL3/SDL.h> // Para SDL_GamepadButton #include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <stddef.h> // Para size_t #include <stddef.h> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
class Input; // lines 8-8 class Input; // lines 10-10
class Text; // lines 9-9 class Text; // lines 11-11
enum class InputAction : int; // lines 10-10 enum class InputAction : int; // lines 12-12
struct DefineButtonsButton struct DefineButtonsButton
{ {
std::string label; // Texto en pantalla para el botón std::string label; // Texto en pantalla para el botón
InputAction input; // Input asociado InputAction input; // Input asociado
SDL_GamepadButton button; // Botón del mando correspondiente SDL_GamepadButton button; // Botón del mando correspondiente
// Constructor // Constructor

View File

@@ -1,42 +1,42 @@
// IWYU pragma: no_include <bits/chrono.h> // IWYU pragma: no_include <bits/chrono.h>
#include "director.h" #include "director.h"
#include <SDL3/SDL.h> // Para SDL_Init, SDL_Quit, SDL_INIT_EV... #include <SDL3/SDL_audio.h> // Para SDL_AudioFormat
#include <SDL3/SDL_audio.h> // Para AUDIO_S16
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND #include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_error.h> // Para SDL_GetError #include <SDL3/SDL_error.h> // Para SDL_GetError
#include <SDL3/SDL_events.h> // Para SDL_DISABLE #include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <SDL3/SDL.h> // Para SDL_GAMEPAD_BUTTON_B, SDL_CO... #include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DRIVER
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DR... #include <SDL3/SDL_init.h> // Para SDL_Init, SDL_Quit, SDL_INIT_VIDEO
#include <SDL3/SDL_mouse.h> // Para SDL_ShowCursor #include <SDL3/SDL_log.h> // Para SDL_Log
#include <SDL3/SDL_scancode.h> // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN #include <SDL3/SDL_mouse.h> // Para SDL_HideCursor
#include <SDL3/SDL_stdinc.h> // Para Uint32, SDL_bool #include <SDL3/SDL_scancode.h> // Para SDL_Scancode
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOO... #include <SDL3/SDL_stdinc.h> // Para SDL_free, SDL_PRIu32, Uint32
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOOLONG
#include <stdio.h> // Para printf, perror #include <stdio.h> // Para printf, perror
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU #include <sys/stat.h> // Para mkdir, stat, S_IRWXU
#include <unistd.h> // Para getuid #include <unistd.h> // Para getuid
#include <algorithm> // Para min #include <algorithm> // Para min
#include <chrono> // Para chrono #include <cstdlib> // Para exit, EXIT_FAILURE, size_t, srand
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, rand #include <ctime> // Para time
#include <iostream> // Para basic_ostream, operator<<, basi... #include <iostream> // Para basic_ostream, operator<<, cout, endl
#include <memory> // Para make_unique, unique_ptr #include <memory> // Para make_unique, unique_ptr
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para operator+, char_traits, allocator #include <string> // Para operator+, char_traits, allocator
#include <vector> // Para vector #include <vector> // Para vector
#include "asset.h" // Para Asset, AssetType #include "asset.h" // Para Asset, AssetType
#include "credits.h" // Para Credits #include "credits.h" // Para Credits
#include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_... #include "game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_MOD...
#include "hiscore_table.h" // Para HiScoreTable #include "hiscore_table.h" // Para HiScoreTable
#include "input.h" // Para Input, InputAction #include "input.h" // Para Input, InputAction
#include "instructions.h" // Para Instructions #include "instructions.h" // Para Instructions
#include "intro.h" // Para Intro #include "intro.h" // Para Intro
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV... #include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume
#include "lang.h" // Para Code, loadFromFile #include "lang.h" // Para Code, loadFromFile
#include "logo.h" // Para Logo #include "logo.h" // Para Logo
#include "manage_hiscore_table.h" // Para ManageHiScoreTable #include "manage_hiscore_table.h" // Para ManageHiScoreTable
#include "notifier.h" // Para Notifier #include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp #include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, options, OptionsContro... #include "options.h" // Para Options, options, GamepadOptions
#include "param.h" // Para Param, ParamGame, param, loadPa... #include "param.h" // Para Param, ParamGame, param, loadParam...
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.h" // Para Name, Options, name, options #include "section.h" // Para Name, Options, name, options
@@ -69,9 +69,8 @@ Director::Director(int argc, const char *argv[])
std::cout << "Game start" << std::endl; std::cout << "Game start" << std::endl;
// Inicia la semilla aleatoria // Inicia la semilla aleatoria usando el tiempo actual en segundos
unsigned int seed = static_cast<unsigned int>(std::chrono::system_clock::now().time_since_epoch().count()); std::srand(static_cast<unsigned int>(std::time(nullptr)));
std::srand(seed);
// Comprueba los parametros del programa // Comprueba los parametros del programa
checkProgramArguments(argc, argv); checkProgramArguments(argc, argv);
@@ -296,15 +295,31 @@ bool Director::initSDL()
else else
{ {
// Obtiene información sobre la pantalla // Obtiene información sobre la pantalla
auto DM = SDL_GetCurrentDisplayMode(0); int i, num_displays = 0;
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
if (displays)
{
for (i = 0; i < num_displays; ++i)
{
SDL_DisplayID instance_id = displays[i];
const char *name = SDL_GetDisplayName(instance_id);
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla SDL_Log("Display %" SDL_PRIu32 ": %s", instance_id, name ? name : "Unknown");
options.video.window.max_zoom = std::min(DM->w / param.game.width, DM->h / param.game.height); }
options.video.window.zoom = std::min(options.video.window.zoom, options.video.window.max_zoom);
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego auto DM = SDL_GetCurrentDisplayMode(displays[0]);
std::cout << "\nCurrent display mode: " << DM->w << "x" << DM->h << " @ " << DM->refresh_rate << "Hz" << std::endl;
std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.zoom << std::endl; // Calcula el máximo factor de zoom que se puede aplicar a la pantalla
options.video.window.max_zoom = std::min(DM->w / param.game.width, DM->h / param.game.height);
options.video.window.zoom = std::min(options.video.window.zoom, options.video.window.max_zoom);
// Muestra información sobre el tamaño de la pantalla y de la ventana de juego
std::cout << "\nCurrent display mode: " << DM->w << "x" << DM->h << " @ " << DM->refresh_rate << "Hz" << std::endl;
std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.zoom << std::endl;
options.video.info = std::to_string(DM->w) + " X " + std::to_string(DM->h) + " AT " + std::to_string(DM->refresh_rate) + " HZ";
SDL_free(displays);
}
// Establece el filtro de la textura // Establece el filtro de la textura
/*if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str())) /*if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str()))
@@ -327,7 +342,7 @@ bool Director::initSDL()
else else
{ {
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones // Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
//Uint32 flags = 0; // Uint32 flags = 0;
if (options.video.v_sync) if (options.video.v_sync)
{ {
// flags = SDL_RENDERER_PRESENTVSYNC; // flags = SDL_RENDERER_PRESENTVSYNC;

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_render.h> // Para SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Renderer
#include <SDL3/SDL_video.h> // Para SDL_Window #include <SDL3/SDL_video.h> // Para SDL_Window

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <string> #include <string>
#include <array> #include <array>

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <string> // Para string #include <string> // Para string

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture

View File

@@ -1,10 +1,9 @@
#include "game.h" #include "game.h"
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND #include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_events.h> // Para SDL_Event, SDL_PollEvent, SDL_KEYDOWN #include <SDL3/SDL_events.h> // Para SDL_EventType, SDL_Event, SDL_Poll...
#include <SDL3/SDL_keycode.h> // Para SDLK_1, SDLK_2, SDLK_3, SDLK_4 #include <SDL3/SDL_keycode.h> // Para SDLK_1, SDLK_2, SDLK_3, SDLK_4
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888 #include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks #include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <SDL3/SDL_video.h> // Para SDL_WINDOWEVENT_FOCUS_GAINED, SDL_...
#include <stdlib.h> // Para rand, size_t #include <stdlib.h> // Para rand, size_t
#include <algorithm> // Para find_if, clamp, min #include <algorithm> // Para find_if, clamp, min
#include <functional> // Para function #include <functional> // Para function
@@ -17,7 +16,7 @@
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check, update #include "global_inputs.h" // Para check, update
#include "input.h" // Para InputAction, Input, INPUT_DO_NOT_ALL... #include "input.h" // Para InputAction, Input, INPUT_DO_NOT_A...
#include "item.h" // Para Item, ItemType #include "item.h" // Para Item, ItemType
#include "jail_audio.h" // Para JA_PlaySound, JA_GetMusicState #include "jail_audio.h" // Para JA_PlaySound, JA_GetMusicState
#include "lang.h" // Para getText #include "lang.h" // Para getText
@@ -29,7 +28,7 @@
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB... #include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB...
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.h" // Para Name, name, AttractMode, attract_mode #include "section.h" // Para Name, name, AttractMode, Options
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.h" // Para SmartSprite
#include "stage.h" // Para number, get, Stage, total_power #include "stage.h" // Para number, get, Stage, total_power
#include "tabe.h" // Para Tabe, TabeState #include "tabe.h" // Para Tabe, TabeState

View File

@@ -1,32 +1,31 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h> // Para SDL_Event
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture
#include <SDL3/SDL_stdinc.h> // Para Uint32, Uint8 #include <SDL3/SDL_stdinc.h> // Para Uint64, Uint8
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_KEYDOWN
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para Options, OptionsGame, options #include "options.h" // Para GameOptions, Options, options
#include "player.h" // Para Player #include "player.h" // Para Player
#include "utils.h" // Para Demo #include "utils.h" // Para Demo
class Asset; // lines 13-13 class Asset; // lines 14-14
class Background; // lines 14-14 class Background; // lines 15-15
class BalloonManager; class BalloonManager; // lines 16-16
class Tabe; class Bullet; // lines 18-18
class Bullet; // lines 15-15 class Fade; // lines 19-19
class Fade; // lines 16-16 class Input; // lines 20-20
class Input; // lines 17-17 class Item; // lines 21-21
class Item; // lines 18-18 class PathSprite; // lines 22-22
class PathSprite; // lines 19-19 class Scoreboard; // lines 23-23
class Scoreboard; // lines 20-20 class Screen; // lines 24-24
class Screen; // lines 21-21 class SmartSprite; // lines 25-25
class SmartSprite; // lines 22-22 class Tabe; // lines 17-17
class Texture; // lines 23-23 class Texture; // lines 26-26
enum class BulletType : Uint8; // lines 24-24 enum class BulletType : Uint8; // lines 27-27
enum class ItemType; // lines 25-25 enum class ItemType; // lines 28-28
struct Path; // lines 26-26 struct Path; // lines 29-29
// Modo demo // Modo demo
constexpr bool GAME_MODE_DEMO_OFF = false; constexpr bool GAME_MODE_DEMO_OFF = false;

View File

@@ -1,15 +1,15 @@
#include "game_logo.h" #include "game_logo.h"
#include <SDL3/SDL_render.h> // Para SDL_FLIP_HORIZONTAL #include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <algorithm> // Para max #include <algorithm> // Para max
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "jail_audio.h" // Para JA_PlaySound #include "jail_audio.h" // Para JA_PlaySound
#include "param.h" // Para Param, param, ParamGame, ParamTitle #include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.h" // Para SmartSprite
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "utils.h" // Para Color #include "utils.h" // Para Color
constexpr int ZOOM_FACTOR = 5; constexpr int ZOOM_FACTOR = 5;
constexpr int FLASH_DELAY = 3; constexpr int FLASH_DELAY = 3;

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite

View File

@@ -1,8 +1,7 @@
#include "global_events.h" #include "global_events.h"
#include <SDL3/SDL_video.h> // Para SDL_WINDOWEVENT_SIZE_CHANGED #include <iostream> // Para char_traits, basic_ostream, operator<<, cout, endl
#include <iostream> // Para char_traits, basic_ostream, operator<< #include "mouse.h" // Para handleEvent
#include "mouse.h" // Para handleEvent #include "section.h" // Para Name, Options, name, options
#include "section.h" // Para Name, Options, name, options
namespace globalEvents namespace globalEvents
{ {

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h> #include <SDL3/SDL_events.h>

View File

@@ -1,15 +1,15 @@
#include "global_inputs.h" #include "global_inputs.h"
#include <SDL3/SDL_render.h> // Para SDL_RenderSetIntegerScale #include <SDL3/SDL_render.h> // Para SDL_RendererLogicalPresentation, SDL_Se...
#include <SDL3/SDL_stdinc.h> // Para SDL_FALSE, SDL_TRUE #include <string> // Para operator+, allocator, char_traits, string
#include <string> // Para operator+, string, to_string, basic_string
#include <vector> // Para vector #include <vector> // Para vector
#include "asset.h" // Para Asset #include "asset.h" // Para Asset
#include "input.h" // Para Input, InputDeviceToUse, InputAction, INP... #include "input.h" // Para Input, InputAction, InputDeviceToUse
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume #include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume
#include "lang.h" // Para getText, Code, getNextLangCode, loadFro... #include "lang.h" // Para getText, Code, getNextLangCode, loadFro...
#include "notifier.h" // Para Notifier #include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp #include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, options, OptionsGame, OptionsV... #include "options.h" // Para Options, options, VideoOptions, GameOpt...
#include "param.h" // Para Param, ParamGame, param
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.h" // Para Name, name, Options, options, AttractMode #include "section.h" // Para Name, name, Options, options, AttractMode
#include "utils.h" // Para boolToOnOff #include "utils.h" // Para boolToOnOff

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
namespace globalInputs namespace globalInputs
{ {

View File

@@ -1,8 +1,8 @@
#include "hiscore_table.h" #include "hiscore_table.h"
#include <SDL3/SDL.h> // Para SDL_BLENDMODE_BLEND #include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event #include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888 #include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_render.h> // Para SDL_QueryTexture #include <SDL3/SDL_render.h> // Para SDL_SetRenderTarget, SDL_CreateTex...
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks #include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <stdlib.h> // Para rand, size_t #include <stdlib.h> // Para rand, size_t
#include <algorithm> // Para max #include <algorithm> // Para max
@@ -15,12 +15,12 @@
#include "jail_audio.h" // Para JA_GetMusicState, JA_Music_state #include "jail_audio.h" // Para JA_GetMusicState, JA_Music_state
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para Options, OptionsGame, options #include "options.h" // Para GameOptions, Options, options
#include "param.h" // Para Param, param, ParamGame, ParamFade #include "param.h" // Para Param, param, ParamGame, ParamFade
#include "path_sprite.h" // Para PathSprite, Path, PathType #include "path_sprite.h" // Para PathSprite, Path, PathType
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.h" // Para Name, name #include "section.h" // Para Name, name, Options, options
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR #include "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR
#include "texture.h" // Para Texture #include "texture.h" // Para Texture

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture

View File

@@ -1,10 +1,9 @@
#include "input.h" #include "input.h"
#include <SDL3/SDL.h> // Para SDL_INIT_GAMECONTROLLER, SDL_InitSubS...
#include <SDL3/SDL_error.h> // Para SDL_GetError #include <SDL3/SDL_error.h> // Para SDL_GetError
#include <SDL3/SDL_events.h> // Para SDL_ENABLE #include <SDL3/SDL_init.h> // Para SDL_INIT_GAMEPAD, SDL_InitSubSystem
#include <SDL3/SDL_keyboard.h> // Para SDL_GetKeyboardState #include <SDL3/SDL_keyboard.h> // Para SDL_GetKeyboardState
#include <algorithm> // Para find #include <algorithm> // Para find
#include <iostream> // Para basic_ostream, operator<<, cout, endl #include <iostream> // Para basic_ostream, operator<<, basic_ostr...
#include <iterator> // Para distance #include <iterator> // Para distance
#include <unordered_map> // Para unordered_map, operator==, _Node_cons... #include <unordered_map> // Para unordered_map, operator==, _Node_cons...
#include <utility> // Para pair #include <utility> // Para pair

View File

@@ -1,11 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_G... #include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton, SDL_Gamepad
#include <SDL3/SDL_joystick.h> // Para SDL_Joystick #include <SDL3/SDL_joystick.h> // Para SDL_Joystick, SDL_JoystickID
#include <SDL3/SDL_scancode.h> // Para SDL_Scancode #include <SDL3/SDL_scancode.h> // Para SDL_Scancode
#include <SDL3/SDL_stdinc.h> // Para Uint8 #include <SDL3/SDL_stdinc.h> // Para Uint8
#include <string> // Para string, basic_string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
/* /*
connectedControllers es un vector donde estan todos los mandos encontrados [0 .. n] connectedControllers es un vector donde estan todos los mandos encontrados [0 .. n]
@@ -81,8 +81,8 @@ private:
struct ControllerBindings struct ControllerBindings
{ {
SDL_GamepadButton button; // GameControllerButton asociado SDL_GamepadButton button; // GameControllerButton asociado
bool active; // Indica si está activo bool active; // Indica si está activo
bool axis_active; // Estado del eje bool axis_active; // Estado del eje
// Constructor // Constructor
explicit ControllerBindings(SDL_GamepadButton btn = SDL_GAMEPAD_BUTTON_INVALID, bool act = false, bool axis_act = false) explicit ControllerBindings(SDL_GamepadButton btn = SDL_GAMEPAD_BUTTON_INVALID, bool act = false, bool axis_act = false)
@@ -90,7 +90,7 @@ private:
}; };
// Variables // Variables
std::vector<SDL_Gamepad *> connected_controllers_; // Vector con todos los mandos conectados std::vector<SDL_Gamepad *> connected_controllers_; // Vector con todos los mandos conectados
std::vector<SDL_Joystick *> joysticks_; // Vector con todos los joysticks conectados std::vector<SDL_Joystick *> joysticks_; // Vector con todos los joysticks conectados
std::vector<KeyBindings> key_bindings_; // Vector con las teclas asociadas a los inputs predefinidos std::vector<KeyBindings> key_bindings_; // Vector con las teclas asociadas a los inputs predefinidos
std::vector<std::vector<ControllerBindings>> controller_bindings_; // Vector con los botones asociadas a los inputs predefinidos para cada mando std::vector<std::vector<ControllerBindings>> controller_bindings_; // Vector con los botones asociadas a los inputs predefinidos para cada mando

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_stdinc.h> // Para Uint32, Uint8 #include <SDL3/SDL_stdinc.h> // Para Uint32, Uint8
#include <memory> // Para unique_ptr #include <memory> // Para unique_ptr

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_stdinc.h> // Para Uint16 #include <SDL3/SDL_stdinc.h> // Para Uint16

View File

@@ -1,8 +1,11 @@
#ifndef JA_USESDLMIXER #ifndef JA_USESDLMIXER
#include "jail_audio.h" #include "jail_audio.h"
#include "stb_vorbis.c" #include <SDL3/SDL_iostream.h> // Para SDL_IOFromMem
#include <SDL3/SDL.h> #include <SDL3/SDL_timer.h> // Para SDL_AddTimer, SDL_RemoveTimer, SDL_Ti...
#include <stdio.h> #include <stdint.h> // Para uint32_t, uint8_t
#include <stdio.h> // Para NULL, fseek, printf, fclose, fopen
#include <stdlib.h> // Para free, malloc
#include "stb_vorbis.c" // Para stb_vorbis_decode_memory
#define JA_MAX_SIMULTANEOUS_CHANNELS 20 #define JA_MAX_SIMULTANEOUS_CHANNELS 20

View File

@@ -1,5 +1,8 @@
#pragma once #pragma once
#include <SDL3/SDL.h> #include <SDL3/SDL_audio.h> // Para SDL_AudioFormat
#include <SDL3/SDL_stdinc.h> // Para Uint32, Uint8
struct JA_Music_t; // lines 22-22
struct JA_Sound_t; // lines 21-21
enum JA_Channel_state enum JA_Channel_state
{ {

View File

@@ -1,10 +1,9 @@
#include "jail_shader.h" #include "jail_shader.h"
#include <SDL3/SDL_rect.h> // Para SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_Point
#include <SDL3/SDL_stdinc.h> // Para SDL_bool #include <cstring> // Para strncmp
#include <cstring> // Para strncmp #include <iostream> // Para basic_ostream, operator<<, endl, cout
#include <iostream> // Para basic_ostream, operator<<, endl, cout #include <stdexcept> // Para runtime_error
#include <stdexcept> // Para runtime_error #include <vector> // Para vector
#include <vector> // Para vector
#ifdef __APPLE__ #ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h" // Para Core Foundation en macOS #include "CoreFoundation/CoreFoundation.h" // Para Core Foundation en macOS
@@ -157,7 +156,7 @@ namespace shader
shader::backBuffer = texturaBackBuffer; shader::backBuffer = texturaBackBuffer;
SDL_GetWindowSize(ventana, &win_size.x, &win_size.y); SDL_GetWindowSize(ventana, &win_size.x, &win_size.y);
//int acceso; // int acceso;
SDL_GetTextureSize(texturaBackBuffer, &tex_size.x, &tex_size.y); SDL_GetTextureSize(texturaBackBuffer, &tex_size.x, &tex_size.y);
// SDL_QueryTexture(texturaBackBuffer, nullptr, &acceso, &tex_size.x, &tex_size.y); // SDL_QueryTexture(texturaBackBuffer, nullptr, &acceso, &tex_size.x, &tex_size.y);
/*if (acceso != SDL_TEXTUREACCESS_TARGET) /*if (acceso != SDL_TEXTUREACCESS_TARGET)

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_render.h> // Para SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Texture
#include <SDL3/SDL_video.h> // Para SDL_Window #include <SDL3/SDL_video.h> // Para SDL_Window

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <string> // Para string #include <string> // Para string

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FPoint
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32

View File

@@ -1,10 +1,10 @@
#include "manage_hiscore_table.h" #include "manage_hiscore_table.h"
#include <SDL3/SDL_error.h> // Para SDL_GetError #include <SDL3/SDL_error.h> // Para SDL_GetError
#include <SDL3/SDL.h> // Para SDL_RWread, SDL_WriteIO, SDL_RWFromFile #include <SDL3/SDL_iostream.h> // Para SDL_ReadIO, SDL_WriteIO, SDL_CloseIO
#include <algorithm> // Para find_if, sort #include <algorithm> // Para find_if, sort
#include <iostream> // Para basic_ostream, operator<<, cout, endl #include <iostream> // Para basic_ostream, operator<<, cout, endl
#include <iterator> // Para distance #include <iterator> // Para distance
#include "utils.h" // Para getFileName #include "utils.h" // Para getFileName
// Resetea la tabla a los valores por defecto // Resetea la tabla a los valores por defecto
void ManageHiScoreTable::clear() void ManageHiScoreTable::clear()

View File

@@ -1,6 +1,5 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h> // Para SDL_Event #include <SDL3/SDL_events.h> // Para SDL_Event
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32

View File

@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_FlipMode #include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <memory> // Para shared_ptr #include <algorithm> // Para max
#include <algorithm> #include <memory> // Para shared_ptr
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
class Texture; // lines 8-8 class Texture; // lines 8-8
// Clase MovingSprite. Añade movimiento y efectos de rotación, zoom y flip al sprite // Clase MovingSprite. Añade movimiento y efectos de rotación, zoom y flip al sprite
class MovingSprite : public Sprite class MovingSprite : public Sprite

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Renderer

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Texture

View File

@@ -1,14 +1,13 @@
#include "options.h" #include "options.h"
#include <SDL3/SDL.h> // Para SDL_GamepadButton #include <algorithm> // Para clamp
#include <algorithm> // Para clamp #include <fstream> // Para basic_ostream, operator<<, basic_ostream::opera...
#include <fstream> // Para basic_ostream, operator<<, basi... #include <iostream> // Para cout
#include <iostream> // Para cout #include <utility> // Para swap
#include <utility> // Para swap #include <vector> // Para vector
#include <vector> // Para vector #include "input.h" // Para InputDeviceToUse
#include "input.h" // Para InputDeviceToUse #include "lang.h" // Para Code
#include "lang.h" // Para Code #include "screen.h" // Para ScreenFilter
#include "screen.h" // Para ScreenFilter #include "utils.h" // Para boolToString, stringToBool, getFileName
#include "utils.h" // Para boolToString, stringToBool, get...
// Variables // Variables
Options options; Options options;

View File

@@ -1,16 +1,15 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_CONTROLLER_BUTTON_B, SDL_CO... #include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <string> // Para string
#include <string> // Para string #include <vector> // Para vector
#include <vector> // Para vector #include "input.h" // Para InputAction, InputDeviceToUse
#include "input.h" // Para InputAction, InputDeviceToUse #include "manage_hiscore_table.h" // Para HiScoreEntry
#include "manage_hiscore_table.h" // Para HiScoreEntry enum class ScreenFilter : int; // lines 8-8
enum class ScreenFilter : int; // lines 8-8
namespace lang namespace lang
{ {
enum class Code : int; enum class Code : int;
} // lines 12-12 } // lines 11-11
// Dificultad del juego // Dificultad del juego
enum class GameDifficulty enum class GameDifficulty
@@ -36,6 +35,7 @@ struct VideoOptions
bool v_sync; // Indica si se quiere usar vsync o no bool v_sync; // Indica si se quiere usar vsync o no
bool integer_scale; // Indica si se va a usar el escalado entero bool integer_scale; // Indica si se va a usar el escalado entero
bool shaders; // Indica si se van a usar shaders para los filtros de video bool shaders; // Indica si se van a usar shaders para los filtros de video
std::string info; // Información sobre el modo de video
}; };
// Estructura para las opciones de musica // Estructura para las opciones de musica

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32

View File

@@ -1,6 +1,5 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "path_sprite.h" #include "path_sprite.h"
#include <cstdlib> // Para abs
#include <functional> // Para function #include <functional> // Para function
#include <utility> // Para move #include <utility> // Para move

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FPoint
#include <functional> // Para function #include <functional> // Para function

View File

@@ -1,17 +1,17 @@
#include "player.h" #include "player.h"
#include <SDL3/SDL_render.h> // Para SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE, SDL... #include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks #include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <stdlib.h> // Para rand #include <stdlib.h> // Para rand
#include <algorithm> // Para clamp, max, min #include <algorithm> // Para clamp, max, min
#include "animated_sprite.h" // Para AnimatedSprite #include <array> // Para array
#include "input.h" // Para InputAction #include "animated_sprite.h" // Para AnimatedSprite
#include "param.h" // Para Param, ParamGame, param #include "input.h" // Para InputAction
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode #include "jail_audio.h" // Para JA_PlaySound
#include "texture.h" // Para Texture #include "param.h" // Para Param, ParamGame, param
#include "resource.h" #include "resource.h" // Para Resource
#include "jail_audio.h" #include "scoreboard.h" // Para Scoreboard, ScoreboardMode
#include "stage.h" #include "stage.h" // Para power_can_be_added
#include <array> #include "texture.h" // Para Texture
// Constructor // Constructor
Player::Player(int id, float x, int y, bool demo, SDL_FRect &play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations) Player::Player(int id, float x, int y, bool demo, SDL_FRect &play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations)

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Texture, SDL_Renderer

View File

@@ -1,18 +1,19 @@
#include "screen.h" #include "screen.h"
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888 #include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks #include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <algorithm> // Para max, min #include <algorithm> // Para max, min
#include <fstream> // Para basic_ifstream, ifstream #include <fstream> // Para basic_ifstream, ifstream
#include <iterator> // Para istreambuf_iterator, operator== #include <iterator> // Para istreambuf_iterator, operator==
#include <string> // Para allocator, char_traits, operator+, to_s... #include <memory> // Para __shared_ptr_access, shared_ptr
#include <string> // Para string, operator+, to_string
#include "asset.h" // Para Asset #include "asset.h" // Para Asset
#include "global_inputs.h" // Para service_pressed_counter
#include "jail_shader.h" // Para init, render #include "jail_shader.h" // Para init, render
#include "mouse.h" // Para updateCursorVisibility #include "mouse.h" // Para updateCursorVisibility
#include "notifier.h" // Para Notifier #include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp #include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, OptionsVideo, options, Options... #include "options.h" // Para Options, VideoOptions, options, WindowO...
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "text.h" // Para Text
// [SINGLETON] // [SINGLETON]
Screen *Screen::screen_ = nullptr; Screen *Screen::screen_ = nullptr;
@@ -35,8 +36,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
dst_rect_(SDL_FRect{0, 0, static_cast<float>(param.game.width), static_cast<float>(param.game.height)}) dst_rect_(SDL_FRect{0, 0, static_cast<float>(param.game.width), static_cast<float>(param.game.height)})
{ {
// Inicializa variables // Inicializa variables
auto DM = SDL_GetCurrentDisplayMode(0);
info_resolution_ = std::to_string(DM->w) + " X " + std::to_string(DM->h) + " AT " + std::to_string(DM->refresh_rate) + " HZ";
adjustRenderLogicalSize(); adjustRenderLogicalSize();
// Muestra la ventana // Muestra la ventana
@@ -212,7 +211,7 @@ void Screen::renderInfo()
text->writeColored(param.game.width - text->lenght(FPS_TEXT), 0, FPS_TEXT, orange_soft_color); text->writeColored(param.game.width - text->lenght(FPS_TEXT), 0, FPS_TEXT, orange_soft_color);
// Resolution // Resolution
text->writeColored(0, 0, info_resolution_, orange_soft_color); text->writeColored(0, 0, options.video.info, orange_soft_color);
} }
} }

View File

@@ -1,15 +1,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_blendmode.h> // Para SDL_BlendMode #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_SetRenderLogicalPrese...
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture #include <SDL3/SDL_stdinc.h> // Para Uint32
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_video.h> // Para SDL_Window, SDL_HideWindow, SDL_ShowWindow
#include <SDL3/SDL_video.h> // Para SDL_Window #include <string> // Para string
#include <string> // Para string #include "options.h" // Para Options, VideoOptions, options
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param
#include "utils.h" // Para Color #include "utils.h" // Para Color
#include "options.h"
enum class ScreenFilter : int enum class ScreenFilter : int
{ {
@@ -160,7 +158,6 @@ private:
SDL_FRect src_rect_; // Coordenadas de donde va a pillar la textura del juego para dibujarla SDL_FRect src_rect_; // Coordenadas de donde va a pillar la textura del juego para dibujarla
SDL_FRect dst_rect_; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana SDL_FRect dst_rect_; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana
FPS fps_; // Variable para gestionar los frames por segundo FPS fps_; // Variable para gestionar los frames por segundo
std::string info_resolution_; // Texto con la informacion de la pantalla
std::string shader_source_; // Almacena el contenido del archivo GLSL std::string shader_source_; // Almacena el contenido del archivo GLSL
FlashEffect flash_effect_; // Variable para gestionar el efecto de flash FlashEffect flash_effect_; // Variable para gestionar el efecto de flash
ShakeEffect shake_effect_; // Variable para gestionar el efecto de agitar la pantalla ShakeEffect shake_effect_; // Variable para gestionar el efecto de agitar la pantalla

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
namespace section namespace section
{ {

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include "animated_sprite.h" // Para SpriteAnimated #include "animated_sprite.h" // Para SpriteAnimated

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <vector> #include <vector>

View File

@@ -1,12 +1,12 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "tabe.h" #include "tabe.h"
#include <SDL3/SDL_render.h> // Para SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE #include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <stdlib.h> // Para rand, abs #include <stdlib.h> // Para rand, abs
#include <algorithm> // Para max #include <algorithm> // Para max
#include "jail_audio.h" // Para JA_PlaySound #include "jail_audio.h" // Para JA_PlaySound
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "utils.h" // Para Zone #include "utils.h" // Para Zone
// Constructor // Constructor
Tabe::Tabe() Tabe::Tabe()

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_stdinc.h> // Para Uint8 #include <SDL3/SDL_stdinc.h> // Para Uint8
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr

View File

@@ -1,15 +1,15 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_blendmode.h> // Para SDL_BlendMode #include <SDL3/SDL_blendmode.h> // Para SDL_BlendMode
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888, SDL_PixelF... #include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_FLIP_NONE, SDL_TEX... #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_TextureAccess, SDL...
#include <SDL3/SDL_stdinc.h> // Para Uint8, Uint16, Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint8, Uint16, Uint32
#include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
struct Color; struct Color; // lines 11-11
// Definiciones de tipos // Definiciones de tipos
struct Surface struct Surface

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect #include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture #include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_stdinc.h> // Para Uint32 #include <SDL3/SDL_stdinc.h> // Para Uint32
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr

View File

@@ -1,16 +1,16 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "utils.h" #include "utils.h"
#include <SDL3/SDL.h> // Para SDL_IOFromFile, SDL_CloseIO, SDL_RIO #include <SDL3/SDL_iostream.h> // Para SDL_CloseIO, SDL_IOFromFile, SDL_ReadIO
#include <stddef.h> // Para size_t #include <stddef.h> // Para size_t
#include <algorithm> // Para min, clamp, find_if_not, find, transform #include <algorithm> // Para min, clamp, find_if_not, find, transform
#include <cctype> // Para tolower, isspace #include <cctype> // Para tolower, isspace
#include <cmath> // Para pow, sin, M_PI, cos #include <cmath> // Para pow, sin, M_PI, cos
#include <compare> // Para operator< #include <compare> // Para operator<
#include <filesystem> // Para path #include <filesystem> // Para path
#include <iostream> // Para basic_ostream, cout, basic_ios, endl, ios #include <iostream> // Para basic_ostream, cout, basic_ios, endl
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para basic_string, string, char_traits, opera... #include <string> // Para basic_string, string, char_traits
#include "lang.h" #include "lang.h" // Para getText
// Variables // Variables
Overrides overrides = Overrides(); Overrides overrides = Overrides();

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
#include <SDL3/SDL_render.h> // Para SDL_Renderer #include <SDL3/SDL_render.h> // Para SDL_Renderer

View File

@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <SDL3/SDL.h>
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string