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_REQUIRED True)
# Configuración global de flags de compilación
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
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")
# Cargar todos los archivos fuente directamente desde el directorio
file(GLOB SOURCES "${CMAKE_SOURCE_DIR}/source/*.cpp")
# Verificar si se encontraron archivos fuente
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()
# Configuración de SDL3 (usando el método recomendado)
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
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
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
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
if(WIN32)
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)
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")
elseif(UNIX AND NOT APPLE)
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)
if(OPENGL_FOUND)
message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}")
@@ -64,13 +55,7 @@ elseif(UNIX AND NOT APPLE)
endif()
endif()
# Añadir OpenGL a las bibliotecas enlazadas
if(NOT WIN32)
find_package(OpenGL REQUIRED)
if(OPENGL_FOUND)
message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}")
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
else()
message(FATAL_ERROR "OpenGL no encontrado")
endif()
endif()
# Configuración común de salida de ejecutables en el directorio raíz
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
# Especificar la ubicación del ejecutable (en la raíz del proyecto)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,27 +1,26 @@
// IWYU pragma: no_include <bits/std_abs.h>
#include "credits.h"
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_QUIT
#include <SDL3/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event
#include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <algorithm> // Para max, min, clamp
#include <cstdlib> // Para abs
#include <array> // Para array
#include <stdexcept> // Para runtime_error
#include <string> // Para basic_string, string
#include <vector> // Para vector
#include <array> // Para vector
#include "balloon_manager.h" // Para BalloonManager
#include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check
#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 "lang.h" // Para getText
#include "global_events.h" // Para handleEvent
#include "param.h" // Para Param, ParamGame, param
#include "player.h" // Para Player, PlayerState
#include "resource.h" // Para Resource
#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 "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW
#include "texture.h" // Para Texture

View File

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

View File

@@ -1,15 +1,14 @@
#pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_events.h> // Para SDL_ControllerButtonEvent
#include <SDL3/SDL.h> // Para SDL_GamepadButton
#include <SDL3/SDL_events.h> // Para SDL_Event, SDL_GamepadButtonEvent
#include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <stddef.h> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
class Input; // lines 8-8
class Text; // lines 9-9
enum class InputAction : int; // lines 10-10
class Input; // lines 10-10
class Text; // lines 11-11
enum class InputAction : int; // lines 12-12
struct DefineButtonsButton
{

View File

@@ -1,42 +1,42 @@
// IWYU pragma: no_include <bits/chrono.h>
#include "director.h"
#include <SDL3/SDL.h> // Para SDL_Init, SDL_Quit, SDL_INIT_EV...
#include <SDL3/SDL_audio.h> // Para AUDIO_S16
#include <SDL3/SDL_audio.h> // Para SDL_AudioFormat
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL3/SDL_error.h> // Para SDL_GetError
#include <SDL3/SDL_events.h> // Para SDL_DISABLE
#include <SDL3/SDL.h> // Para SDL_GAMEPAD_BUTTON_B, SDL_CO...
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DR...
#include <SDL3/SDL_mouse.h> // Para SDL_ShowCursor
#include <SDL3/SDL_scancode.h> // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN
#include <SDL3/SDL_stdinc.h> // Para Uint32, SDL_bool
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOO...
#include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DRIVER
#include <SDL3/SDL_init.h> // Para SDL_Init, SDL_Quit, SDL_INIT_VIDEO
#include <SDL3/SDL_log.h> // Para SDL_Log
#include <SDL3/SDL_mouse.h> // Para SDL_HideCursor
#include <SDL3/SDL_scancode.h> // Para SDL_Scancode
#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 <sys/stat.h> // Para mkdir, stat, S_IRWXU
#include <unistd.h> // Para getuid
#include <algorithm> // Para min
#include <chrono> // Para chrono
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, rand
#include <iostream> // Para basic_ostream, operator<<, basi...
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, srand
#include <ctime> // Para time
#include <iostream> // Para basic_ostream, operator<<, cout, endl
#include <memory> // Para make_unique, unique_ptr
#include <stdexcept> // Para runtime_error
#include <string> // Para operator+, char_traits, allocator
#include <vector> // Para vector
#include "asset.h" // Para Asset, AssetType
#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 "input.h" // Para Input, InputAction
#include "instructions.h" // Para Instructions
#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 "logo.h" // Para Logo
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
#include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, options, OptionsContro...
#include "param.h" // Para Param, ParamGame, param, loadPa...
#include "options.h" // Para Options, options, GamepadOptions
#include "param.h" // Para Param, ParamGame, param, loadParam...
#include "resource.h" // Para Resource
#include "screen.h" // Para Screen
#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;
// Inicia la semilla aleatoria
unsigned int seed = static_cast<unsigned int>(std::chrono::system_clock::now().time_since_epoch().count());
std::srand(seed);
// Inicia la semilla aleatoria usando el tiempo actual en segundos
std::srand(static_cast<unsigned int>(std::time(nullptr)));
// Comprueba los parametros del programa
checkProgramArguments(argc, argv);
@@ -296,7 +295,19 @@ bool Director::initSDL()
else
{
// 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);
SDL_Log("Display %" SDL_PRIu32 ": %s", instance_id, name ? name : "Unknown");
}
auto DM = SDL_GetCurrentDisplayMode(displays[0]);
// 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);
@@ -305,6 +316,10 @@ bool Director::initSDL()
// 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
/*if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str()))

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,9 @@
#include "game.h"
#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_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_video.h> // Para SDL_WINDOWEVENT_FOCUS_GAINED, SDL_...
#include <stdlib.h> // Para rand, size_t
#include <algorithm> // Para find_if, clamp, min
#include <functional> // Para function
@@ -17,7 +16,7 @@
#include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check
#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 "jail_audio.h" // Para JA_PlaySound, JA_GetMusicState
#include "lang.h" // Para getText
@@ -29,7 +28,7 @@
#include "resource.h" // Para Resource
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB...
#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 "stage.h" // Para number, get, Stage, total_power
#include "tabe.h" // Para Tabe, TabeState

View File

@@ -1,32 +1,31 @@
#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_stdinc.h> // Para Uint32, Uint8
#include <SDL3/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_KEYDOWN
#include <SDL3/SDL_stdinc.h> // Para Uint64, Uint8
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
#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 "utils.h" // Para Demo
class Asset; // lines 13-13
class Background; // lines 14-14
class BalloonManager;
class Tabe;
class Bullet; // lines 15-15
class Fade; // lines 16-16
class Input; // lines 17-17
class Item; // lines 18-18
class PathSprite; // lines 19-19
class Scoreboard; // lines 20-20
class Screen; // lines 21-21
class SmartSprite; // lines 22-22
class Texture; // lines 23-23
enum class BulletType : Uint8; // lines 24-24
enum class ItemType; // lines 25-25
struct Path; // lines 26-26
class Asset; // lines 14-14
class Background; // lines 15-15
class BalloonManager; // lines 16-16
class Bullet; // lines 18-18
class Fade; // lines 19-19
class Input; // lines 20-20
class Item; // lines 21-21
class PathSprite; // lines 22-22
class Scoreboard; // lines 23-23
class Screen; // lines 24-24
class SmartSprite; // lines 25-25
class Tabe; // lines 17-17
class Texture; // lines 26-26
enum class BulletType : Uint8; // lines 27-27
enum class ItemType; // lines 28-28
struct Path; // lines 29-29
// Modo demo
constexpr bool GAME_MODE_DEMO_OFF = false;

View File

@@ -1,5 +1,5 @@
#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 "animated_sprite.h" // Para AnimatedSprite
#include "jail_audio.h" // Para JA_PlaySound

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,15 @@
#include "global_inputs.h"
#include <SDL3/SDL_render.h> // Para SDL_RenderSetIntegerScale
#include <SDL3/SDL_stdinc.h> // Para SDL_FALSE, SDL_TRUE
#include <string> // Para operator+, string, to_string, basic_string
#include <SDL3/SDL_render.h> // Para SDL_RendererLogicalPresentation, SDL_Se...
#include <string> // Para operator+, allocator, char_traits, string
#include <vector> // Para vector
#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 "lang.h" // Para getText, Code, getNextLangCode, loadFro...
#include "notifier.h" // Para Notifier
#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 "section.h" // Para Name, name, Options, options, AttractMode
#include "utils.h" // Para boolToOnOff

View File

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

View File

@@ -1,8 +1,8 @@
#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_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
#include <SDL3/SDL_render.h> // Para SDL_QueryTexture
#include <SDL3/SDL_pixels.h> // Para SDL_PixelFormat
#include <SDL3/SDL_render.h> // Para SDL_SetRenderTarget, SDL_CreateTex...
#include <SDL3/SDL_timer.h> // Para SDL_GetTicks
#include <stdlib.h> // Para rand, size_t
#include <algorithm> // Para max
@@ -15,12 +15,12 @@
#include "jail_audio.h" // Para JA_GetMusicState, JA_Music_state
#include "lang.h" // Para getText
#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 "path_sprite.h" // Para PathSprite, Path, PathType
#include "resource.h" // Para Resource
#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 "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR
#include "texture.h" // Para Texture

View File

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

View File

@@ -1,10 +1,9 @@
#include "input.h"
#include <SDL3/SDL.h> // Para SDL_INIT_GAMECONTROLLER, SDL_InitSubS...
#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 <algorithm> // Para find
#include <iostream> // Para basic_ostream, operator<<, cout, endl
#include <iostream> // Para basic_ostream, operator<<, basic_ostr...
#include <iterator> // Para distance
#include <unordered_map> // Para unordered_map, operator==, _Node_cons...
#include <utility> // Para pair

View File

@@ -1,10 +1,10 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_G...
#include <SDL3/SDL_joystick.h> // Para SDL_Joystick
#include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton, SDL_Gamepad
#include <SDL3/SDL_joystick.h> // Para SDL_Joystick, SDL_JoystickID
#include <SDL3/SDL_scancode.h> // Para SDL_Scancode
#include <SDL3/SDL_stdinc.h> // Para Uint8
#include <string> // Para string, basic_string
#include <string> // Para string
#include <vector> // Para vector
/*

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,11 @@
#ifndef JA_USESDLMIXER
#include "jail_audio.h"
#include "stb_vorbis.c"
#include <SDL3/SDL.h>
#include <stdio.h>
#include <SDL3/SDL_iostream.h> // Para SDL_IOFromMem
#include <SDL3/SDL_timer.h> // Para SDL_AddTimer, SDL_RemoveTimer, SDL_Ti...
#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

View File

@@ -1,5 +1,8 @@
#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
{

View File

@@ -1,6 +1,5 @@
#include "jail_shader.h"
#include <SDL3/SDL_rect.h> // Para SDL_FPoint
#include <SDL3/SDL_stdinc.h> // Para SDL_bool
#include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_Point
#include <cstring> // Para strncmp
#include <iostream> // Para basic_ostream, operator<<, endl, cout
#include <stdexcept> // Para runtime_error

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
#include "manage_hiscore_table.h"
#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 <iostream> // Para basic_ostream, operator<<, cout, endl
#include <iterator> // Para distance

View File

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

View File

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

View File

@@ -1,10 +1,9 @@
#pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
#include <SDL3/SDL_render.h> // Para SDL_FlipMode
#include <SDL3/SDL_rect.h> // Para SDL_FPoint, SDL_FRect
#include <SDL3/SDL_surface.h> // Para SDL_FlipMode
#include <algorithm> // Para max
#include <memory> // Para shared_ptr
#include <algorithm>
#include "sprite.h" // Para Sprite
class Texture; // lines 8-8

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,17 +1,17 @@
#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 <stdlib.h> // Para rand
#include <algorithm> // Para clamp, max, min
#include <array> // Para array
#include "animated_sprite.h" // Para AnimatedSprite
#include "input.h" // Para InputAction
#include "jail_audio.h" // Para JA_PlaySound
#include "param.h" // Para Param, ParamGame, param
#include "resource.h" // Para Resource
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode
#include "stage.h" // Para power_can_be_added
#include "texture.h" // Para Texture
#include "resource.h"
#include "jail_audio.h"
#include "stage.h"
#include <array>
// 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)

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,19 @@
#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 <algorithm> // Para max, min
#include <fstream> // Para basic_ifstream, ifstream
#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 "global_inputs.h" // Para service_pressed_counter
#include "jail_shader.h" // Para init, render
#include "mouse.h" // Para updateCursorVisibility
#include "notifier.h" // Para Notifier
#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 "text.h" // Para Text
// [SINGLETON]
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)})
{
// 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();
// 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);
// 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
#include <SDL3/SDL.h>
#include <SDL3/SDL_blendmode.h> // Para SDL_BlendMode
#include <SDL3/SDL_rect.h> // Para SDL_FRect, SDL_FPoint
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture
#include <SDL3/SDL_rect.h> // Para SDL_FRect
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_SetRenderLogicalPrese...
#include <SDL3/SDL_stdinc.h> // Para Uint32
#include <SDL3/SDL_video.h> // Para SDL_Window
#include <SDL3/SDL_video.h> // Para SDL_Window, SDL_HideWindow, SDL_ShowWindow
#include <string> // Para string
#include "options.h" // Para Options, VideoOptions, options
#include "param.h" // Para Param, ParamGame, param
#include "utils.h" // Para Color
#include "options.h"
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 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
std::string info_resolution_; // Texto con la informacion de la pantalla
std::string shader_source_; // Almacena el contenido del archivo GLSL
FlashEffect flash_effect_; // Variable para gestionar el efecto de flash
ShakeEffect shake_effect_; // Variable para gestionar el efecto de agitar la pantalla

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
// IWYU pragma: no_include <bits/std_abs.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 <algorithm> // Para max
#include "jail_audio.h" // Para JA_PlaySound

View File

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

View File

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

View File

@@ -1,15 +1,15 @@
#pragma once
#include <SDL3/SDL.h>
#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_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_surface.h> // Para SDL_FlipMode
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <vector> // Para vector
struct Color;
struct Color; // lines 11-11
// Definiciones de tipos
struct Surface

View File

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

View File

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

View File

@@ -1,16 +1,16 @@
#define _USE_MATH_DEFINES
#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 <algorithm> // Para min, clamp, find_if_not, find, transform
#include <cctype> // Para tolower, isspace
#include <cmath> // Para pow, sin, M_PI, cos
#include <compare> // Para operator<
#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 <string> // Para basic_string, string, char_traits, opera...
#include "lang.h"
#include <string> // Para basic_string, string, char_traits
#include "lang.h" // Para getText
// Variables
Overrides overrides = Overrides();

View File

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

View File

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