renombrades extensions .h a .hpp

This commit is contained in:
2025-10-17 21:45:19 +02:00
parent 50ccb2ccc2
commit 46974ef2eb
144 changed files with 1758 additions and 1783 deletions

View File

@@ -1,43 +0,0 @@
# Directrices de Desarrollo - Coffee Crisis Arcade Edition
## Directrices Principales Confirmadas
### 1. **Sistema Temporal**
- **TODO migrado de frame based a time based**
- **Delta time en segundos (float)**
- **Unidades de tiempo: SOLO segundos** (no frames, no milisegundos)
### 2. **Contadores y Timers**
- **CRECIENTES**: para sistemas con múltiples eventos temporales (timeline)
- Patrón: `elapsed_time += deltaTime; if (elapsed_time >= EVENT_TIME) { /* acción */ }`
- **DECRECIENTES**: para contadores con diferentes valores de inicialización
- Patrón: `timer -= deltaTime; if (timer <= 0.0f) { /* acción */ timer = DURATION; }`
### 3. **Números Mágicos**
- **Definidos en constantes**
- **Preferencia**: cabecera de la clase
- **Excepción**: si es algo local a un método específico
## Problemas Pendientes de Reparación (game.cpp)
### ❌ PENDIENTES
1. **param.fade.post_duration_ms verification** (líneas 89, 1671)
2. **setRotateSpeed verification** (línea 797)
3. **TOTAL_DEMO_DATA - 200 magic number** (línea 1669)
4. **Comprehensive magic number search** - Buscar 100, 150, 200, 250, 300, 400, 500, 1000
### 4. **Velocidades y Aceleraciones**
- **Velocidades**: pixels/segundo
- **Aceleraciones**: pixels/segundo²
### 5. **Documentación de Conversiones**
- **Comentarios explicativos** en cambios críticos de timing
- Documentar conversiones frame→tiempo en el código
### 6. **Patrón de Constantes**
- Crear constantes para valores repetidos (evitar duplicación)
- Nombres descriptivos para constantes de tiempo
---
**Estado**: Directrices completas confirmadas

View File

@@ -1,4 +1,4 @@
#include "animated_sprite.h" #include "animated_sprite.hpp"
#include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError, SDL_FRect #include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError, SDL_FRect
@@ -9,9 +9,9 @@
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <utility> // Para pair #include <utility> // Para pair
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "utils.h" // Para printWithDots #include "utils.hpp" // Para printWithDots
// Carga las animaciones en un vector(Animations) desde un fichero // Carga las animaciones en un vector(Animations) desde un fichero
auto loadAnimationsFromFile(const std::string& file_path) -> AnimationsFileBuffer { auto loadAnimationsFromFile(const std::string& file_path) -> AnimationsFileBuffer {

View File

@@ -10,7 +10,7 @@
#include <utility> #include <utility>
#include <vector> // Para vector #include <vector> // Para vector
#include "moving_sprite.h" // Para MovingSprite #include "moving_sprite.hpp" // Para MovingSprite
// Declaración adelantada // Declaración adelantada
class Texture; class Texture;

View File

@@ -1,4 +1,4 @@
#include "asset.h" #include "asset.hpp"
#include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn #include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn
@@ -10,9 +10,9 @@
#include <sstream> // Para basic_istringstream #include <sstream> // Para basic_istringstream
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
#include "utils.h" // Para getFileName #include "ui/logger.hpp" // Pâra Logger
#include "ui/logger.h" // Pâra Logger #include "utils.hpp" // Para getFileName
// Singleton // Singleton
Asset* Asset::instance = nullptr; Asset* Asset::instance = nullptr;
@@ -226,7 +226,8 @@ auto Asset::checkFile(const std::string &path) const -> bool {
if (!success) { if (!success) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error: Could not open file: %s", path.c_str()); "Error: Could not open file: %s",
path.c_str());
} }
return success; return success;

View File

@@ -1,4 +1,4 @@
#include "asset_integrated.h" #include "asset_integrated.hpp"
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>

View File

@@ -2,8 +2,8 @@
#include <memory> #include <memory>
#include "asset.h" #include "asset.hpp"
#include "resource_loader.h" #include "resource_loader.hpp"
// Extensión de Asset que integra ResourceLoader // Extensión de Asset que integra ResourceLoader
class AssetIntegrated : public Asset { class AssetIntegrated : public Asset {

View File

@@ -1,12 +1,12 @@
#include "audio.h" #include "audio.hpp"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_G... #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_G...
#include <algorithm> // Para clamp #include <algorithm> // Para clamp
#include "external/jail_audio.h" // Para JA_FadeOutMusic, JA_Init, JA_PauseM... #include "external/jail_audio.h" // Para JA_FadeOutMusic, JA_Init, JA_PauseM...
#include "options.h" // Para AudioOptions, audio, MusicOptions #include "options.hpp" // Para AudioOptions, audio, MusicOptions
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
// Singleton // Singleton
Audio* Audio::instance = nullptr; Audio* Audio::instance = nullptr;

View File

@@ -1,5 +1,5 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "background.h" #include "background.hpp"
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetRenderTarget, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_TextureAccess, SDL_FPoint #include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetRenderTarget, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_TextureAccess, SDL_FPoint
@@ -7,14 +7,14 @@
#include <cmath> // Para M_PI, cos, sin #include <cmath> // Para M_PI, cos, sin
#include <utility> #include <utility>
#include "animated_sprite.h" // Para MovingSprite #include "animated_sprite.hpp" // Para MovingSprite
#include "moving_sprite.h" // Para MovingSprite #include "moving_sprite.hpp" // Para MovingSprite
#include "param.h" // Para Param, ParamBackground, param #include "param.hpp" // Para Param, ParamBackground, param
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "utils.h" // Para funciones de easing #include "utils.hpp" // Para funciones de easing
// Constructor // Constructor
Background::Background(float total_progress_to_complete) Background::Background(float total_progress_to_complete)

View File

@@ -8,7 +8,7 @@
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "color.h" // Para Color #include "color.hpp" // Para Color
class MovingSprite; class MovingSprite;
class Sprite; class Sprite;

View File

@@ -1,14 +1,14 @@
#include "balloon.h" #include "balloon.hpp"
#include <algorithm> // Para clamp #include <algorithm> // Para clamp
#include <array> // Para array #include <array> // Para array
#include <cmath> // Para fabs #include <cmath> // Para fabs
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "param.h" // Para Param, ParamBalloon, param #include "param.hpp" // Para Param, ParamBalloon, param
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
// Constructor // Constructor
Balloon::Balloon(const Config& config) Balloon::Balloon(const Config& config)

View File

@@ -8,8 +8,8 @@
#include <string_view> // Para string_view #include <string_view> // Para string_view
#include <vector> // Para vector #include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.hpp" // Para Circle
class Texture; class Texture;

View File

@@ -1,4 +1,4 @@
#include "balloon_formations.h" #include "balloon_formations.hpp"
#include <algorithm> // Para max, min, copy #include <algorithm> // Para max, min, copy
#include <array> // Para array #include <array> // Para array
@@ -11,10 +11,10 @@
#include <sstream> // Para basic_istringstream #include <sstream> // Para basic_istringstream
#include <string> // Para string, char_traits, allocator, operator==, stoi, getline, operator<=>, basic_string #include <string> // Para string, char_traits, allocator, operator==, stoi, getline, operator<=>, basic_string
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "balloon.h" // Para Balloon #include "balloon.hpp" // Para Balloon
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "utils.h" // Para Zone, BLOCK #include "utils.hpp" // Para Zone, BLOCK
void BalloonFormations::initFormations() { void BalloonFormations::initFormations() {
// Calcular posiciones base // Calcular posiciones base

View File

@@ -8,7 +8,7 @@
#include <utility> // Para pair #include <utility> // Para pair
#include <vector> // Para vector #include <vector> // Para vector
#include "balloon.h" // Para Balloon #include "balloon.hpp" // Para Balloon
// --- Clase BalloonFormations --- // --- Clase BalloonFormations ---
class BalloonFormations { class BalloonFormations {

View File

@@ -1,19 +1,19 @@
#include "balloon_manager.h" #include "balloon_manager.hpp"
#include <algorithm> // Para remove_if #include <algorithm> // Para remove_if
#include <array> #include <array>
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include <numeric> // Para accumulate #include <numeric> // Para accumulate
#include "balloon.h" // Para Balloon, Balloon::SCORE.at( )ALLOON_VELX... #include "balloon.hpp" // Para Balloon, Balloon::SCORE.at( )ALLOON_VELX...
#include "balloon_formations.h" // Para BalloonFormationParams, BalloonForma... #include "balloon_formations.hpp" // Para BalloonFormationParams, BalloonForma...
#include "color.h" // Para Zone, Color, flash_color #include "color.hpp" // Para Zone, Color, flash_color
#include "explosions.h" // Para Explosions #include "explosions.hpp" // Para Explosions
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "stage_interface.h" // Para IStageInfo #include "stage_interface.hpp" // Para IStageInfo
#include "utils.h" #include "utils.hpp"
// Constructor // Constructor
BalloonManager::BalloonManager(IStageInfo* stage_info) BalloonManager::BalloonManager(IStageInfo* stage_info)

View File

@@ -8,12 +8,12 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "balloon.h" // Para BALLOON_SPEED, Balloon, Balloon::Size (ptr only), Balloon::Type (ptr only) #include "balloon.hpp" // Para BALLOON_SPEED, Balloon, Balloon::Size (ptr only), Balloon::Type (ptr only)
#include "balloon_formations.h" // Para BalloonFormations #include "balloon_formations.hpp" // Para BalloonFormations
#include "explosions.h" // Para Explosions #include "explosions.hpp" // Para Explosions
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "stage_interface.h" // Para IStageInfo #include "stage_interface.hpp" // Para IStageInfo
#include "utils.h" // Para Zone #include "utils.hpp" // Para Zone
class Texture; class Texture;

View File

@@ -1,11 +1,11 @@
#include "bullet.h" #include "bullet.hpp"
#include <memory> // Para allocator, unique_ptr, make_unique #include <memory> // Para allocator, unique_ptr, make_unique
#include <string> // Para char_traits, basic_string, operator+, string #include <string> // Para char_traits, basic_string, operator+, string
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "player.h" // Para Player::Id #include "player.hpp" // Para Player::Id
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
// Constructor // Constructor
Bullet::Bullet(float x, float y, Type type, Color color, int owner) Bullet::Bullet(float x, float y, Type type, Color color, int owner)

View File

@@ -5,8 +5,8 @@
#include <memory> // Para unique_ptr #include <memory> // Para unique_ptr
#include <string> // Para string #include <string> // Para string
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.hpp" // Para Circle
// --- Clase Bullet: representa una bala del jugador --- // --- Clase Bullet: representa una bala del jugador ---
class Bullet { class Bullet {

View File

@@ -1,10 +1,10 @@
#include "bullet_manager.h" #include "bullet_manager.hpp"
#include <algorithm> // Para remove_if #include <algorithm> // Para remove_if
#include "bullet.h" // Para Bullet #include "bullet.hpp" // Para Bullet
#include "param.h" // Para param #include "param.hpp" // Para param
#include "player.h" // Para Player #include "player.hpp" // Para Player
// Constructor // Constructor
BulletManager::BulletManager() BulletManager::BulletManager()
@@ -39,8 +39,7 @@ void BulletManager::freeBullets() {
if (!bullets_.empty()) { if (!bullets_.empty()) {
// Elimina las balas deshabilitadas del vector // Elimina las balas deshabilitadas del vector
bullets_.erase( bullets_.erase(
std::remove_if(bullets_.begin(), bullets_.end(), std::remove_if(bullets_.begin(), bullets_.end(), [](const std::shared_ptr<Bullet>& bullet) {
[](const std::shared_ptr<Bullet>& bullet) {
return !bullet->isEnabled(); return !bullet->isEnabled();
}), }),
bullets_.end()); bullets_.end());

View File

@@ -6,8 +6,8 @@
#include <memory> // Para shared_ptr, unique_ptr #include <memory> // Para shared_ptr, unique_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "bullet.h" // Para Bullet #include "bullet.hpp" // Para Bullet
#include "utils.h" // Para Circle #include "utils.hpp" // Para Circle
// --- Types --- // --- Types ---
using Bullets = std::vector<std::shared_ptr<Bullet>>; using Bullets = std::vector<std::shared_ptr<Bullet>>;

View File

@@ -1,5 +1,5 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "color.h" #include "color.hpp"
#include <cctype> // Para isxdigit #include <cctype> // Para isxdigit
#include <cmath> // Para sinf, fmaxf, fminf, M_PI, fmodf, roundf, fmod #include <cmath> // Para sinf, fmaxf, fminf, M_PI, fmodf, roundf, fmod

View File

@@ -109,8 +109,7 @@ struct Color {
lerp_component(r, target.r), lerp_component(r, target.r),
lerp_component(g, target.g), lerp_component(g, target.g),
lerp_component(b, target.b), lerp_component(b, target.b),
lerp_component(a, target.a) lerp_component(a, target.a));
);
} }
// Sobrecarga para aceptar componentes RGBA directamente // Sobrecarga para aceptar componentes RGBA directamente

View File

@@ -4,8 +4,8 @@
#include <array> #include <array>
#include "color.h" #include "color.hpp"
#include "ui/notifier.h" // Para Notifier::Position #include "ui/notifier.hpp" // Para Notifier::Position
#include "version.h" // Para Version::APP_NAME #include "version.h" // Para Version::APP_NAME
// --- Namespace GameDefaults: configuración centralizada con valores por defecto del juego --- // --- Namespace GameDefaults: configuración centralizada con valores por defecto del juego ---

View File

@@ -1,18 +1,18 @@
#include "define_buttons.h" #include "define_buttons.hpp"
#include <algorithm> // Para __all_of_fn, all_of #include <algorithm> // Para __all_of_fn, all_of
#include <functional> // Para identity #include <functional> // Para identity
#include <memory> // Para allocator, unique_ptr, shared_ptr, make_unique, operator== #include <memory> // Para allocator, unique_ptr, shared_ptr, make_unique, operator==
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "input_types.h" // Para InputAction #include "input_types.hpp" // Para InputAction
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "options.h" // Para Gamepad #include "options.hpp" // Para Gamepad
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "ui/window_message.h" // Para WindowMessage #include "ui/window_message.hpp" // Para WindowMessage
#include "utils.h" // Para Zone #include "utils.hpp" // Para Zone
DefineButtons::DefineButtons() DefineButtons::DefineButtons()
: input_(Input::get()) { : input_(Input::get()) {

View File

@@ -8,8 +8,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "input.h" #include "input.hpp"
#include "ui/window_message.h" #include "ui/window_message.hpp"
namespace Options { namespace Options {
struct Gamepad; struct Gamepad;

View File

@@ -1,10 +1,11 @@
#include "demo.h" #include "demo.hpp"
#include <SDL3/SDL.h> // Para SDL_IOStream, SDL_IOFromConstMem, SDL_IOFromFile, SDL_ReadIO, SDL_WriteIO, SDL_CloseIO #include <SDL3/SDL.h> // Para SDL_IOStream, SDL_IOFromConstMem, SDL_IOFromFile, SDL_ReadIO, SDL_WriteIO, SDL_CloseIO
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
#include "utils.h" // Para printWithDots, getFileName #include "utils.hpp" // Para printWithDots, getFileName
// Carga el fichero de datos para la demo // Carga el fichero de datos para la demo
auto loadDemoDataFromFile(const std::string& file_path) -> DemoData { auto loadDemoDataFromFile(const std::string& file_path) -> DemoData {

View File

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

View File

@@ -1,4 +1,4 @@
#include "difficulty.h" #include "difficulty.hpp"
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,5 +1,5 @@
// IWYU pragma: no_include <bits/chrono.h> // IWYU pragma: no_include <bits/chrono.h>
#include "director.h" #include "director.hpp"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_SetLogPriority, SDL_LogPriority, SDL_Quit #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_SetLogPriority, SDL_LogPriority, SDL_Quit
@@ -11,30 +11,30 @@
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para allocator, char_traits, operator==, string, basic_string, operator+ #include <string> // Para allocator, char_traits, operator==, string, basic_string, operator+
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "lang.h" // Para setLanguage #include "lang.hpp" // Para setLanguage
#include "manage_hiscore_table.h" // Para ManageHiScoreTable #include "manage_hiscore_table.hpp" // Para ManageHiScoreTable
#include "options.h" // Para loadFromFile, saveToFile, Settings, settings, setConfigFile, setControllersFile #include "options.hpp" // Para loadFromFile, saveToFile, Settings, settings, setConfigFile, setControllersFile
#include "param.h" // Para loadParamsFromFile #include "param.hpp" // Para loadParamsFromFile
#include "player.h" // Para Player #include "player.hpp" // Para Player
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, Options, name, options, AttractMode, attract_mode #include "section.hpp" // Para Name, Options, name, options, AttractMode, attract_mode
#include "sections/credits.h" // Para Credits #include "sections/credits.hpp" // Para Credits
#include "sections/game.h" // Para Game #include "sections/game.hpp" // Para Game
#include "sections/hiscore_table.h" // Para HiScoreTable #include "sections/hiscore_table.hpp" // Para HiScoreTable
#include "sections/instructions.h" // Para Instructions #include "sections/instructions.hpp" // Para Instructions
#include "sections/intro.h" // Para Intro #include "sections/intro.hpp" // Para Intro
#include "sections/logo.h" // Para Logo #include "sections/logo.hpp" // Para Logo
#include "sections/title.h" // Para Title #include "sections/title.hpp" // Para Title
#include "shutdown.h" // Para resultToString, shutdownSystem, ShutdownResult #include "shutdown.hpp" // Para resultToString, shutdownSystem, ShutdownResult
#include "system_utils.h" // Para createApplicationFolder, resultToString, Result #include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.h" // Para Overrides, overrides, getPath #include "utils.hpp" // Para Overrides, overrides, getPath
// Constructor // Constructor
Director::Director(int argc, std::span<char*> argv) { Director::Director(int argc, std::span<char*> argv) {

View File

@@ -1,4 +1,4 @@
#include "enter_name.h" #include "enter_name.hpp"
#include <array> // Para array #include <array> // Para array
#include <cstdlib> // Para rand #include <cstdlib> // Para rand

View File

@@ -1,8 +1,8 @@
#include "explosions.h" #include "explosions.hpp"
#include <algorithm> // Para max #include <algorithm> // Para max
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
class Texture; // lines 4-4 class Texture; // lines 4-4

View File

@@ -5,7 +5,7 @@
#include <utility> // Para move #include <utility> // Para move
#include <vector> // Para vector #include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
class Texture; class Texture;

View File

@@ -1,4 +1,4 @@
#include "gif.h" #include "gif.hpp"
#include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, SDL_LogInfo #include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, SDL_LogInfo
#include <cstring> // Para memcpy, size_t #include <cstring> // Para memcpy, size_t

View File

@@ -10,7 +10,7 @@
#include ... #include ...
#include ... #include ...
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.hpp"
You can #define STBI_ASSERT(x) before the #include to avoid using assert.h. You can #define STBI_ASSERT(x) before the #include to avoid using assert.h.
And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free

View File

@@ -1,13 +1,13 @@
#include "fade.h" #include "fade.hpp"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_FRect, SDL_GetRenderTarget, SDL_RenderFillRect, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, Uint8, SDL_GetRenderDrawBlendMode, SDL_BLENDMODE_NONE, SDL_BlendMode, SDL_CreateTexture, SDL_DestroyTexture, SDL_RenderClear, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_TextureAccess #include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_FRect, SDL_GetRenderTarget, SDL_RenderFillRect, SDL_SetRenderDrawBlendMode, SDL_SetRenderDrawColor, Uint8, SDL_GetRenderDrawBlendMode, SDL_BLENDMODE_NONE, SDL_BlendMode, SDL_CreateTexture, SDL_DestroyTexture, SDL_RenderClear, SDL_RenderTexture, SDL_SetTextureAlphaMod, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_TextureAccess
#include <algorithm> // Para min, max #include <algorithm> // Para min, max
#include <cstdlib> // Para rand, size_t #include <cstdlib> // Para rand, size_t
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "param.h" // Para Param, param, ParamGame, ParamFade #include "param.hpp" // Para Param, param, ParamGame, ParamFade
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
// Constructor // Constructor
Fade::Fade() Fade::Fade()

View File

@@ -1,18 +1,18 @@
#include "game_logo.h" #include "game_logo.hpp"
#include <SDL3/SDL.h> // Para SDL_SetTextureScaleMode, SDL_FlipMode, SDL_ScaleMode #include <SDL3/SDL.h> // Para SDL_SetTextureScaleMode, SDL_FlipMode, SDL_ScaleMode
#include <algorithm> // Para max #include <algorithm> // Para max
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "param.h" // Para Param, param, ParamGame, ParamTitle #include "param.hpp" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.hpp" // Para SmartSprite
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
constexpr int ZOOM_FACTOR = 5; constexpr int ZOOM_FACTOR = 5;
constexpr float FLASH_DELAY_S = 0.05f; // 3 frames → 0.05s constexpr float FLASH_DELAY_S = 0.05f; // 3 frames → 0.05s
@@ -193,7 +193,6 @@ void GameLogo::handleArcadeEditionShaking(float deltaTime) {
} }
} }
void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float deltaTime) { void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float deltaTime) {
shake_.time_accumulator += deltaTime; shake_.time_accumulator += deltaTime;
@@ -255,7 +254,6 @@ void GameLogo::updateDustSprites(float deltaTime) {
void GameLogo::updatePostFinishedCounter(float deltaTime) { void GameLogo::updatePostFinishedCounter(float deltaTime) {
if (coffee_crisis_status_ == Status::FINISHED && if (coffee_crisis_status_ == Status::FINISHED &&
arcade_edition_status_ == Status::FINISHED) { arcade_edition_status_ == Status::FINISHED) {
post_finished_timer_ += deltaTime; post_finished_timer_ += deltaTime;
} }
} }

View File

@@ -1,125 +0,0 @@
#pragma once
#include <memory> // Para unique_ptr, shared_ptr
#include "animated_sprite.h" // Para AnimatedSprite
#include "smart_sprite.h" // Para SmartSprite
#include "sprite.h" // Para Sprite
class Texture;
// --- Clase GameLogo: gestor del logo del juego ---
class GameLogo {
public:
// --- Constantes ---
static constexpr float COFFEE_VEL_Y = 0.15F * 1000.0F; // Velocidad Y de coffee sprite (pixels/s) - 0.15F * 1000 = 150 pixels/s
static constexpr float COFFEE_ACCEL_Y = 0.00036F * 1000000.0F; // Aceleración Y de coffee sprite (pixels/s²) - 0.00036F * 1000000 = 360 pixels/s²
static constexpr float CRISIS_VEL_Y = -0.15F * 1000.0F; // Velocidad Y de crisis sprite (pixels/s) - -0.15F * 1000 = -150 pixels/s
static constexpr float CRISIS_ACCEL_Y = -0.00036F * 1000000.0F; // Aceleración Y de crisis sprite (pixels/s²) - -0.00036F * 1000000 = -360 pixels/s²
static constexpr int CRISIS_OFFSET_X = 15; // Desplazamiento X de crisis sprite
static constexpr int DUST_SIZE = 16; // Tamaño de dust sprites
static constexpr float ZOOM_DECREMENT_PER_S = 0.006F * 1000.0F; // Decremento de zoom por segundo (0.006F * 1000 = 6.0F per second)
static constexpr float SHAKE_DELAY_S = 33.34F / 1000.0F; // Delay de shake en segundos (33.34ms / 1000 = 0.03334s)
static constexpr float POST_FINISHED_FRAME_TIME_S = 16.67F / 1000.0F; // Tiempo entre decrementos del counter (16.67ms / 1000 = 0.01667s)
// --- Constructores y destructor ---
GameLogo(int x, int y);
~GameLogo() = default;
// --- Métodos principales ---
void render(); // Pinta la clase en pantalla
void update(float deltaTime); // Actualiza la lógica de la clase (time-based)
void enable(); // Activa la clase
// --- Getters ---
[[nodiscard]] auto hasFinished() const -> bool; // Indica si ha terminado la animación
private:
// --- Enums ---
enum class Status {
DISABLED, // Deshabilitado
MOVING, // En movimiento
SHAKING, // Temblando
FINISHED, // Terminado
};
// --- Estructuras privadas ---
struct Shake {
int desp = 1; // Pixels de desplazamiento para agitar la pantalla en el eje x
int delay = 2; // Retraso entre cada desplazamiento de la pantalla al agitarse (frame-based)
int length = 8; // Cantidad de desplazamientos a realizar
int remaining = length; // Cantidad de desplazamientos pendientes a realizar
int counter = delay; // Contador para el retraso (frame-based)
float time_accumulator = 0.0f; // Acumulador de tiempo para deltaTime
int origin = 0; // Valor inicial de la pantalla para dejarla igual tras el desplazamiento
Shake() = default;
Shake(int d, int de, int l, int o)
: desp(d),
delay(de),
length(l),
remaining(l),
counter(de),
origin(o) {}
void init(int d, int de, int l, int o) {
desp = d;
delay = de;
length = l;
remaining = l;
counter = de;
time_accumulator = 0.0f;
origin = o;
}
};
// --- Objetos y punteros ---
std::shared_ptr<Texture> dust_texture_; // Textura con los graficos del polvo
std::shared_ptr<Texture> coffee_texture_; // Textura con los graficos de la palabra "COFFEE"
std::shared_ptr<Texture> crisis_texture_; // Textura con los graficos de la palabra "CRISIS"
std::shared_ptr<Texture> arcade_edition_texture_; // Textura con los graficos de "Arcade Edition"
std::unique_ptr<AnimatedSprite> dust_left_sprite_; // Sprite del polvo (izquierda)
std::unique_ptr<AnimatedSprite> dust_right_sprite_; // Sprite del polvo (derecha)
std::unique_ptr<SmartSprite> coffee_sprite_; // Sprite de "COFFEE"
std::unique_ptr<SmartSprite> crisis_sprite_; // Sprite de "CRISIS"
std::unique_ptr<Sprite> arcade_edition_sprite_; // Sprite de "Arcade Edition"
// --- Variables de estado ---
Shake shake_; // Efecto de agitación
Status coffee_crisis_status_ = Status::DISABLED; // Estado de "COFFEE CRISIS"
Status arcade_edition_status_ = Status::DISABLED; // Estado de "ARCADE EDITION"
float x_; // Posición X del logo
float y_; // Posición Y del logo
float zoom_ = 1.0F; // Zoom aplicado al texto "ARCADE EDITION"
float post_finished_delay_s_ = POST_FINISHED_FRAME_TIME_S; // Retraso final tras animaciones (s)
float post_finished_timer_ = 0.0f; // Timer acumulado para retraso final (s)
// --- Inicialización ---
void init(); // Inicializa las variables
[[nodiscard]] auto getInitialVerticalDesp() const -> int; // Calcula el desplazamiento vertical inicial
// --- Actualización de estados específicos ---
void updateCoffeeCrisis(float deltaTime); // Actualiza el estado de "Coffee Crisis" (time-based)
void updateArcadeEdition(float deltaTime); // Actualiza el estado de "Arcade Edition" (time-based)
void updatePostFinishedCounter(float deltaTime); // Actualiza el contador tras finalizar una animación (time-based)
// --- Efectos visuales: movimiento y sacudidas ---
void handleCoffeeCrisisMoving(float deltaTime); // Maneja el movimiento de "Coffee Crisis" (time-based)
void handleCoffeeCrisisShaking(float deltaTime); // Maneja la sacudida de "Coffee Crisis" (time-based)
void handleArcadeEditionMoving(float deltaTime); // Maneja el movimiento de "Arcade Edition" (time-based)
void handleArcadeEditionShaking(float deltaTime); // Maneja la sacudida de "Arcade Edition" (time-based)
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite = nullptr); // Procesa el efecto de sacudida en sprites (frame-based)
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float deltaTime); // Procesa el efecto de sacudida en sprites (time-based)
void processArcadeEditionShake(float deltaTime); // Procesa la sacudida específica de "Arcade Edition" (time-based)
[[nodiscard]] auto calculateShakeDisplacement() const -> int; // Calcula el desplazamiento de la sacudida
// --- Gestión de finalización de efectos ---
void handleCoffeeCrisisFinished(float deltaTime); // Maneja el final de la animación "Coffee Crisis" (time-based)
void finishCoffeeCrisisShaking(); // Finaliza la sacudida de "Coffee Crisis"
void finishArcadeEditionMoving(); // Finaliza el movimiento de "Arcade Edition"
// --- Utilidades ---
static void playTitleEffects(); // Reproduce efectos visuales/sonoros del título
void updateDustSprites(float deltaTime); // Actualiza los sprites de polvo (time-based)
};

125
source/game_logo.hpp Normal file
View File

@@ -0,0 +1,125 @@
#pragma once
#include <memory> // Para unique_ptr, shared_ptr
#include "animated_sprite.hpp" // Para AnimatedSprite
#include "smart_sprite.hpp" // Para SmartSprite
#include "sprite.hpp" // Para Sprite
class Texture;
// --- Clase GameLogo: gestor del logo del juego ---
class GameLogo {
public:
// --- Constantes ---
static constexpr float COFFEE_VEL_Y = 0.15F * 1000.0F; // Velocidad Y de coffee sprite (pixels/s) - 0.15F * 1000 = 150 pixels/s
static constexpr float COFFEE_ACCEL_Y = 0.00036F * 1000000.0F; // Aceleración Y de coffee sprite (pixels/s²) - 0.00036F * 1000000 = 360 pixels/s²
static constexpr float CRISIS_VEL_Y = -0.15F * 1000.0F; // Velocidad Y de crisis sprite (pixels/s) - -0.15F * 1000 = -150 pixels/s
static constexpr float CRISIS_ACCEL_Y = -0.00036F * 1000000.0F; // Aceleración Y de crisis sprite (pixels/s²) - -0.00036F * 1000000 = -360 pixels/s²
static constexpr int CRISIS_OFFSET_X = 15; // Desplazamiento X de crisis sprite
static constexpr int DUST_SIZE = 16; // Tamaño de dust sprites
static constexpr float ZOOM_DECREMENT_PER_S = 0.006F * 1000.0F; // Decremento de zoom por segundo (0.006F * 1000 = 6.0F per second)
static constexpr float SHAKE_DELAY_S = 33.34F / 1000.0F; // Delay de shake en segundos (33.34ms / 1000 = 0.03334s)
static constexpr float POST_FINISHED_FRAME_TIME_S = 16.67F / 1000.0F; // Tiempo entre decrementos del counter (16.67ms / 1000 = 0.01667s)
// --- Constructores y destructor ---
GameLogo(int x, int y);
~GameLogo() = default;
// --- Métodos principales ---
void render(); // Pinta la clase en pantalla
void update(float deltaTime); // Actualiza la lógica de la clase (time-based)
void enable(); // Activa la clase
// --- Getters ---
[[nodiscard]] auto hasFinished() const -> bool; // Indica si ha terminado la animación
private:
// --- Enums ---
enum class Status {
DISABLED, // Deshabilitado
MOVING, // En movimiento
SHAKING, // Temblando
FINISHED, // Terminado
};
// --- Estructuras privadas ---
struct Shake {
int desp = 1; // Pixels de desplazamiento para agitar la pantalla en el eje x
int delay = 2; // Retraso entre cada desplazamiento de la pantalla al agitarse (frame-based)
int length = 8; // Cantidad de desplazamientos a realizar
int remaining = length; // Cantidad de desplazamientos pendientes a realizar
int counter = delay; // Contador para el retraso (frame-based)
float time_accumulator = 0.0f; // Acumulador de tiempo para deltaTime
int origin = 0; // Valor inicial de la pantalla para dejarla igual tras el desplazamiento
Shake() = default;
Shake(int d, int de, int l, int o)
: desp(d),
delay(de),
length(l),
remaining(l),
counter(de),
origin(o) {}
void init(int d, int de, int l, int o) {
desp = d;
delay = de;
length = l;
remaining = l;
counter = de;
time_accumulator = 0.0f;
origin = o;
}
};
// --- Objetos y punteros ---
std::shared_ptr<Texture> dust_texture_; // Textura con los graficos del polvo
std::shared_ptr<Texture> coffee_texture_; // Textura con los graficos de la palabra "COFFEE"
std::shared_ptr<Texture> crisis_texture_; // Textura con los graficos de la palabra "CRISIS"
std::shared_ptr<Texture> arcade_edition_texture_; // Textura con los graficos de "Arcade Edition"
std::unique_ptr<AnimatedSprite> dust_left_sprite_; // Sprite del polvo (izquierda)
std::unique_ptr<AnimatedSprite> dust_right_sprite_; // Sprite del polvo (derecha)
std::unique_ptr<SmartSprite> coffee_sprite_; // Sprite de "COFFEE"
std::unique_ptr<SmartSprite> crisis_sprite_; // Sprite de "CRISIS"
std::unique_ptr<Sprite> arcade_edition_sprite_; // Sprite de "Arcade Edition"
// --- Variables de estado ---
Shake shake_; // Efecto de agitación
Status coffee_crisis_status_ = Status::DISABLED; // Estado de "COFFEE CRISIS"
Status arcade_edition_status_ = Status::DISABLED; // Estado de "ARCADE EDITION"
float x_; // Posición X del logo
float y_; // Posición Y del logo
float zoom_ = 1.0F; // Zoom aplicado al texto "ARCADE EDITION"
float post_finished_delay_s_ = POST_FINISHED_FRAME_TIME_S; // Retraso final tras animaciones (s)
float post_finished_timer_ = 0.0f; // Timer acumulado para retraso final (s)
// --- Inicialización ---
void init(); // Inicializa las variables
[[nodiscard]] auto getInitialVerticalDesp() const -> int; // Calcula el desplazamiento vertical inicial
// --- Actualización de estados específicos ---
void updateCoffeeCrisis(float deltaTime); // Actualiza el estado de "Coffee Crisis" (time-based)
void updateArcadeEdition(float deltaTime); // Actualiza el estado de "Arcade Edition" (time-based)
void updatePostFinishedCounter(float deltaTime); // Actualiza el contador tras finalizar una animación (time-based)
// --- Efectos visuales: movimiento y sacudidas ---
void handleCoffeeCrisisMoving(float deltaTime); // Maneja el movimiento de "Coffee Crisis" (time-based)
void handleCoffeeCrisisShaking(float deltaTime); // Maneja la sacudida de "Coffee Crisis" (time-based)
void handleArcadeEditionMoving(float deltaTime); // Maneja el movimiento de "Arcade Edition" (time-based)
void handleArcadeEditionShaking(float deltaTime); // Maneja la sacudida de "Arcade Edition" (time-based)
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite = nullptr); // Procesa el efecto de sacudida en sprites (frame-based)
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite, float deltaTime); // Procesa el efecto de sacudida en sprites (time-based)
void processArcadeEditionShake(float deltaTime); // Procesa la sacudida específica de "Arcade Edition" (time-based)
[[nodiscard]] auto calculateShakeDisplacement() const -> int; // Calcula el desplazamiento de la sacudida
// --- Gestión de finalización de efectos ---
void handleCoffeeCrisisFinished(float deltaTime); // Maneja el final de la animación "Coffee Crisis" (time-based)
void finishCoffeeCrisisShaking(); // Finaliza la sacudida de "Coffee Crisis"
void finishArcadeEditionMoving(); // Finaliza el movimiento de "Arcade Edition"
// --- Utilidades ---
static void playTitleEffects(); // Reproduce efectos visuales/sonoros del título
void updateDustSprites(float deltaTime); // Actualiza los sprites de polvo (time-based)
};

View File

@@ -6,7 +6,7 @@
#include <vector> #include <vector>
#include "external/json.hpp" #include "external/json.hpp"
#include "input_types.h" // Solo incluimos los tipos compartidos #include "input_types.hpp" // Solo incluimos los tipos compartidos
// --- Estructuras --- // --- Estructuras ---
struct GamepadConfig { struct GamepadConfig {

View File

@@ -1,4 +1,4 @@
#include "global_events.h" #include "global_events.hpp"
#include <SDL3/SDL.h> // Para SDL_EventType, SDL_Event, SDL_LogInfo, SDL_LogCategory #include <SDL3/SDL.h> // Para SDL_EventType, SDL_Event, SDL_LogInfo, SDL_LogCategory
@@ -6,14 +6,14 @@
#include <string> // Para allocator, operator+, string #include <string> // Para allocator, operator+, string
#include <vector> // Para vector #include <vector> // Para vector
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "mouse.h" // Para handleEvent #include "mouse.hpp" // Para handleEvent
#include "options.h" // Para GamepadManager, gamepad_manager #include "options.hpp" // Para GamepadManager, gamepad_manager
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, Options, name, options #include "section.hpp" // Para Name, Options, name, options
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
namespace GlobalEvents { namespace GlobalEvents {
// Comprueba los eventos de Input y muestra notificaciones // Comprueba los eventos de Input y muestra notificaciones

View File

@@ -1,4 +1,4 @@
#include "global_inputs.h" #include "global_inputs.hpp"
#include <algorithm> // Para std::ranges::any_of #include <algorithm> // Para std::ranges::any_of
#include <functional> // Para function #include <functional> // Para function
@@ -7,16 +7,16 @@
#include <utility> // Para pair #include <utility> // Para pair
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "input_types.h" // Para InputAction #include "input_types.hpp" // Para InputAction
#include "lang.h" // Para getText, getLangFile, getLangName, getNextLangCode, loadFromFile #include "lang.hpp" // Para getText, getLangFile, getLangName, getNextLangCode, loadFromFile
#include "options.h" // Para Video, video, Settings, settings, Audio, audio, Window, window #include "options.hpp" // Para Video, video, Settings, settings, Audio, audio, Window, window
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name, Options, options, AttractMode, attract_mode #include "section.hpp" // Para Name, name, Options, options, AttractMode, attract_mode
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.h" // Para boolToOnOff #include "utils.hpp" // Para boolToOnOff
namespace GlobalInputs { namespace GlobalInputs {
// Termina // Termina

View File

@@ -4,8 +4,8 @@
#include <memory> // Para std::unique_ptr y std::shared_ptr #include <memory> // Para std::unique_ptr y std::shared_ptr
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
// --- Estructura Hit: representa una colisión o impacto visual --- // --- Estructura Hit: representa una colisión o impacto visual ---
struct Hit { struct Hit {

View File

@@ -1,4 +1,4 @@
#include "input.h" #include "input.hpp"
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_GetGamepadAxis, SDL_GetError, SDL_GamepadAxis, SDL_JoystickID, SDL_AddGamepadMappingsFromFile, SDL_Event, SDL_EventType, SDL_GetGamepadButton, SDL_GetKeyboardState, SDL_INIT_GAMEPAD, SDL_InitSubSystem, SDL_LogCategory, SDL_LogError, SDL_LogInfo, SDL_OpenGamepad, SDL_PollEvent, SDL_WasInit, SDL_Gamepad, SDL_Scancode #include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_GetGamepadAxis, SDL_GetError, SDL_GamepadAxis, SDL_JoystickID, SDL_AddGamepadMappingsFromFile, SDL_Event, SDL_EventType, SDL_GetGamepadButton, SDL_GetKeyboardState, SDL_INIT_GAMEPAD, SDL_InitSubSystem, SDL_LogCategory, SDL_LogError, SDL_LogInfo, SDL_OpenGamepad, SDL_PollEvent, SDL_WasInit, SDL_Gamepad, SDL_Scancode

View File

@@ -8,8 +8,8 @@
#include <unordered_map> // Para unordered_map #include <unordered_map> // Para unordered_map
#include <vector> // Para vector #include <vector> // Para vector
#include "gamepad_config_manager.h" // Para GamepadConfig (ptr only), GamepadConfigs #include "gamepad_config_manager.hpp" // Para GamepadConfig (ptr only), GamepadConfigs
#include "input_types.h" // Para InputAction #include "input_types.hpp" // Para InputAction
// --- Clase Input: gestiona la entrada de teclado y mandos (singleton) --- // --- Clase Input: gestiona la entrada de teclado y mandos (singleton) ---
class Input { class Input {

View File

@@ -1,4 +1,4 @@
#include "input_types.h" #include "input_types.hpp"
// Definición de los mapas // Definición de los mapas
const std::unordered_map<InputAction, std::string> ACTION_TO_STRING = { const std::unordered_map<InputAction, std::string> ACTION_TO_STRING = {

View File

@@ -1,11 +1,11 @@
#include "item.h" #include "item.hpp"
#include <algorithm> // Para clamp #include <algorithm> // Para clamp
#include <cmath> // Para fmod #include <cmath> // Para fmod
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
class Texture; // lines 6-6 class Texture; // lines 6-6

View File

@@ -6,8 +6,8 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.hpp" // Para Circle
class Texture; class Texture;

View File

@@ -1,4 +1,4 @@
#include "lang.h" #include "lang.hpp"
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <exception> // Para exception #include <exception> // Para exception
@@ -7,11 +7,11 @@
#include <utility> // Para pair #include <utility> // Para pair
#include <vector> // Para vector #include <vector> // Para vector
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "difficulty.h" // Para Difficulty #include "difficulty.hpp" // Para Difficulty
#include "external/json.hpp" // Para basic_json, iteration_proxy_value, oper... #include "external/json.hpp" // Para basic_json, iteration_proxy_value, oper...
#include "options.h" // Para SettingsOpt... #include "options.hpp" // Para SettingsOpt...
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
using json = nlohmann::json; using json = nlohmann::json;

View File

@@ -10,7 +10,7 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024
#include <memory> // Para make_unique, unique_ptr #include <memory> // Para make_unique, unique_ptr
#include <span> // Para span #include <span> // Para span
#include "director.h" // Para Director #include "director.hpp" // Para Director
auto main(int argc, char* argv[]) -> int { auto main(int argc, char* argv[]) -> int {
// Crea el objeto Director // Crea el objeto Director

View File

@@ -1,11 +1,11 @@
#include "manage_hiscore_table.h" #include "manage_hiscore_table.hpp"
#include <SDL3/SDL.h> // Para SDL_ReadIO, SDL_WriteIO, SDL_CloseIO, SDL_GetError, SDL_IOFromFile, SDL_LogCategory, SDL_LogError, SDL_LogInfo #include <SDL3/SDL.h> // Para SDL_ReadIO, SDL_WriteIO, SDL_CloseIO, SDL_GetError, SDL_IOFromFile, SDL_LogCategory, SDL_LogError, SDL_LogInfo
#include <algorithm> // Para find_if, sort #include <algorithm> // Para find_if, sort
#include <iterator> // Para distance #include <iterator> // Para distance
#include "utils.h" // Para getFileName #include "utils.hpp" // 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,4 +1,4 @@
#include "mouse.h" #include "mouse.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_HideCursor, SDL_Show... #include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_HideCursor, SDL_Show...

View File

@@ -1,9 +1,9 @@
#include "moving_sprite.h" #include "moving_sprite.hpp"
#include <cmath> // Para std::abs #include <cmath> // Para std::abs
#include <utility> #include <utility>
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
// Constructor // Constructor
MovingSprite::MovingSprite(std::shared_ptr<Texture> texture, SDL_FRect pos, Rotate rotate, float horizontal_zoom, float vertical_zoom, SDL_FlipMode flip) MovingSprite::MovingSprite(std::shared_ptr<Texture> texture, SDL_FRect pos, Rotate rotate, float horizontal_zoom, float vertical_zoom, SDL_FlipMode flip)

View File

@@ -5,7 +5,7 @@
#include <algorithm> // Para max #include <algorithm> // Para max
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
class Texture; class Texture;

View File

@@ -1,4 +1,4 @@
#include "options.h" #include "options.hpp"
#include <SDL3/SDL.h> // Para SDL_ScaleMode, SDL_GamepadButton, SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn #include <SDL3/SDL.h> // Para SDL_ScaleMode, SDL_GamepadButton, SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn
@@ -6,18 +6,18 @@
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <fstream> // Para basic_ostream, operator<<, basic_ostream::operator<<, basic_ofstream, basic_istream, basic_ifstream, ifstream, ofstream #include <fstream> // Para basic_ostream, operator<<, basic_ostream::operator<<, basic_ofstream, basic_istream, basic_ifstream, ifstream, ofstream
#include <functional> // Para function #include <functional> // Para function
#include <sstream> // Para istringstream
#include <map> // Para map, operator==, _Rb_tree_const_iterator #include <map> // Para map, operator==, _Rb_tree_const_iterator
#include <ranges> // Para std::ranges::any_of #include <ranges> // Para std::ranges::any_of
#include <sstream> // Para istringstream
#include <stdexcept> // Para invalid_argument, out_of_range #include <stdexcept> // Para invalid_argument, out_of_range
#include <string> // Para char_traits, stoi, operator==, operator<<, allocator, string, basic_string, operator<=>, getline #include <string> // Para char_traits, stoi, operator==, operator<<, allocator, string, basic_string, operator<=>, getline
#include <utility> // Para swap, pair #include <utility> // Para swap, pair
#include <vector> // Para vector #include <vector> // Para vector
#include "difficulty.h" // Para Code, init #include "difficulty.hpp" // Para Code, init
#include "input.h" // Para InputDevice #include "input.hpp" // Para InputDevice
#include "lang.h" // Para Code #include "lang.hpp" // Para Code
#include "utils.h" // Para boolToString, stringToBool, getFileName #include "utils.hpp" // Para boolToString, stringToBool, getFileName
namespace Options { namespace Options {
// --- Variables globales --- // --- Variables globales ---
@@ -105,7 +105,6 @@ auto loadFromFile() -> bool {
return true; return true;
} }
// Guarda el fichero de configuración // Guarda el fichero de configuración
auto saveToFile() -> bool { auto saveToFile() -> bool {
std::ofstream file(settings.config_file); std::ofstream file(settings.config_file);

View File

@@ -14,12 +14,12 @@
#include <utility> // Para swap #include <utility> // Para swap
#include <vector> // Para vector #include <vector> // Para vector
#include "defaults.h" // Para GameDefaults #include "defaults.hpp" // Para GameDefaults
#include "difficulty.h" // Para Code #include "difficulty.hpp" // Para Code
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "lang.h" // Para Code #include "lang.hpp" // Para Code
#include "manage_hiscore_table.h" // Para ManageHiScoreTable, Table #include "manage_hiscore_table.hpp" // Para ManageHiScoreTable, Table
#include "player.h" // Para Player #include "player.hpp" // Para Player
// --- Namespace Options: gestión de configuración y opciones del juego --- // --- Namespace Options: gestión de configuración y opciones del juego ---
namespace Options { namespace Options {

View File

@@ -1,4 +1,4 @@
#include "param.h" #include "param.hpp"
#include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogError, SDL_LogInfo #include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogError, SDL_LogInfo
@@ -9,9 +9,9 @@
#include <string> // Para operator==, stoi, char_traits, string, ope... #include <string> // Para operator==, stoi, char_traits, string, ope...
#include <unordered_map> #include <unordered_map>
#include "color.h" #include "color.hpp"
#include "ui/notifier.h" // Para Notifier::Position #include "ui/notifier.hpp" // Para Notifier::Position
#include "utils.h" #include "utils.hpp"
// Variable global - ahora se inicializa automáticamente con valores por defecto // Variable global - ahora se inicializa automáticamente con valores por defecto
Param param; Param param;
@@ -90,7 +90,7 @@ auto setParams(const std::string& var, const std::string& value) -> bool {
{"game.play_area.rect.x", [](const std::string& v) { param.game.play_area.rect.x = std::stoi(v); }}, {"game.play_area.rect.x", [](const std::string& v) { param.game.play_area.rect.x = std::stoi(v); }},
{"game.play_area.rect.y", [](const std::string& v) { param.game.play_area.rect.y = std::stoi(v); }}, {"game.play_area.rect.y", [](const std::string& v) { param.game.play_area.rect.y = std::stoi(v); }},
{"game.play_area.rect.w", [](const std::string& v) { param.game.play_area.rect.w = std::stoi(v); }}, {"game.play_area.rect.w", [](const std::string& v) { param.game.play_area.rect.w = std::stoi(v); }},
{"game.play_area.rect.h", [](const std::string& v) { param.game.play_area.rect.h = std::stoi(v); }}, {"game.play_area.rect.hpp", [](const std::string& v) { param.game.play_area.rect.h = std::stoi(v); }},
{"game.name_entry_idle_time", [](const std::string& v) { param.game.name_entry_idle_time = std::stoi(v); }}, {"game.name_entry_idle_time", [](const std::string& v) { param.game.name_entry_idle_time = std::stoi(v); }},
{"game.name_entry_total_time", [](const std::string& v) { param.game.name_entry_total_time = std::stoi(v); }}, {"game.name_entry_total_time", [](const std::string& v) { param.game.name_entry_total_time = std::stoi(v); }},
{"game.hit_stop_ms", [](const std::string& v) { param.game.hit_stop_ms = std::stoi(v); }}, {"game.hit_stop_ms", [](const std::string& v) { param.game.hit_stop_ms = std::stoi(v); }},
@@ -102,7 +102,7 @@ auto setParams(const std::string& var, const std::string& value) -> bool {
{"scoreboard.rect.x", [](const std::string& v) { param.scoreboard.rect.x = std::stoi(v); }}, {"scoreboard.rect.x", [](const std::string& v) { param.scoreboard.rect.x = std::stoi(v); }},
{"scoreboard.rect.y", [](const std::string& v) { param.scoreboard.rect.y = std::stoi(v); }}, {"scoreboard.rect.y", [](const std::string& v) { param.scoreboard.rect.y = std::stoi(v); }},
{"scoreboard.rect.w", [](const std::string& v) { param.scoreboard.rect.w = std::stoi(v); }}, {"scoreboard.rect.w", [](const std::string& v) { param.scoreboard.rect.w = std::stoi(v); }},
{"scoreboard.rect.h", [](const std::string& v) { param.scoreboard.rect.h = std::stoi(v); }}, {"scoreboard.rect.hpp", [](const std::string& v) { param.scoreboard.rect.h = std::stoi(v); }},
{"scoreboard.skip_countdown_value", [](const std::string& v) { param.scoreboard.skip_countdown_value = std::stoi(v); }}, {"scoreboard.skip_countdown_value", [](const std::string& v) { param.scoreboard.skip_countdown_value = std::stoi(v); }},
{"title.press_start_position", [](const std::string& v) { param.title.press_start_position = std::stoi(v); }}, {"title.press_start_position", [](const std::string& v) { param.title.press_start_position = std::stoi(v); }},
{"title.arcade_edition_position", [](const std::string& v) { param.title.arcade_edition_position = std::stoi(v); }}, {"title.arcade_edition_position", [](const std::string& v) { param.title.arcade_edition_position = std::stoi(v); }},

View File

@@ -5,10 +5,10 @@
#include <array> // Para array #include <array> // Para array
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include "color.h" // Para Color, Zone #include "color.hpp" // Para Color, Zone
#include "defaults.h" // Para los valores por defecto #include "defaults.hpp" // Para los valores por defecto
#include "ui/notifier.h" // Para Notifier::Position #include "ui/notifier.hpp" // Para Notifier::Position
#include "utils.h" #include "utils.hpp"
// --- Parámetros del juego --- // --- Parámetros del juego ---
struct ParamGame { struct ParamGame {

View File

@@ -1,12 +1,13 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "path_sprite.h" #include "path_sprite.hpp"
#include <functional> // Para function #include <functional> // Para function
#include <utility> // Para move #include <utility> // Para move
// Constructor para paths por puntos (convertido a segundos) // Constructor para paths por puntos (convertido a segundos)
Path::Path(const std::vector<SDL_FPoint>& spots_init, float waiting_time_s_init) Path::Path(const std::vector<SDL_FPoint>& spots_init, float waiting_time_s_init)
: spots(spots_init), is_point_path(true) { : spots(spots_init),
is_point_path(true) {
waiting_time_s = waiting_time_s_init; waiting_time_s = waiting_time_s_init;
} }

View File

@@ -7,7 +7,7 @@
#include <utility> #include <utility>
#include <vector> // Para vector #include <vector> // Para vector
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
class Texture; class Texture;
@@ -39,8 +39,13 @@ struct Path { // Define un re
// Constructor para paths generados // Constructor para paths generados
Path(float start, float end, PathType path_type, float fixed, float duration, float waiting, std::function<double(double)> easing) Path(float start, float end, PathType path_type, float fixed, float duration, float waiting, std::function<double(double)> easing)
: start_pos(start), end_pos(end), type(path_type), fixed_pos(fixed), : start_pos(start),
duration_s(duration), waiting_time_s(waiting), easing_function(std::move(easing)) {} end_pos(end),
type(path_type),
fixed_pos(fixed),
duration_s(duration),
waiting_time_s(waiting),
easing_function(std::move(easing)) {}
// Constructor para paths por puntos (convertido a segundos) // Constructor para paths por puntos (convertido a segundos)
Path(const std::vector<SDL_FPoint>& spots_init, float waiting_time_s_init); Path(const std::vector<SDL_FPoint>& spots_init, float waiting_time_s_init);

View File

@@ -1,4 +1,4 @@
#include "player.h" #include "player.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_FlipMode #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_FlipMode
@@ -6,17 +6,17 @@
#include <cmath> // Para fmod #include <cmath> // Para fmod
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "input_types.h" // Para InputAction #include "input_types.hpp" // Para InputAction
#include "manage_hiscore_table.h" // Para ManageHiScoreTable, HiScoreEntry #include "manage_hiscore_table.hpp" // Para ManageHiScoreTable, HiScoreEntry
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "scoreboard.h" // Para Scoreboard #include "scoreboard.hpp" // Para Scoreboard
#include "stage.h" // Para power_can_be_added #include "stage.hpp" // Para power_can_be_added
#include "stage_interface.h" // Para IStageInfo #include "stage_interface.hpp" // Para IStageInfo
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#ifdef _DEBUG #ifdef _DEBUG
#include <iostream> #include <iostream>
#endif #endif

View File

@@ -7,14 +7,14 @@
#include <utility> // Para pair #include <utility> // Para pair
#include <vector> // Para vector #include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.hpp" // Para AnimatedSprite
#include "bullet.h" // Para Bullet #include "bullet.hpp" // Para Bullet
#include "enter_name.h" // Para EnterName #include "enter_name.hpp" // Para EnterName
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "manage_hiscore_table.h" // Para Table #include "manage_hiscore_table.hpp" // Para Table
#include "scoreboard.h" // Para Scoreboard #include "scoreboard.hpp" // Para Scoreboard
#include "stage_interface.h" // Para IStageInfo #include "stage_interface.hpp" // Para IStageInfo
#include "utils.h" // Para Circle #include "utils.hpp" // Para Circle
class Texture; class Texture;

View File

@@ -1,6 +1,7 @@
#include "opengl_shader.h" #include "opengl_shader.hpp"
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <cstring> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
@@ -53,7 +54,9 @@ void OpenGLShader::checkGLError(const char* operation) {
GLenum error = glGetError(); GLenum error = glGetError();
if (error != GL_NO_ERROR) { if (error != GL_NO_ERROR) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error OpenGL en %s: 0x%x", operation, error); "Error OpenGL en %s: 0x%x",
operation,
error);
} }
} }
@@ -90,7 +93,8 @@ GLuint OpenGLShader::compileShader(const std::string& source, GLenum shader_type
std::vector<char> log(log_length); std::vector<char> log(log_length);
glGetShaderInfoLog(shader_id, log_length, &log_length, log.data()); glGetShaderInfoLog(shader_id, log_length, &log_length, log.data());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Log de compilación: %s", log.data()); "Log de compilación: %s",
log.data());
} }
glDeleteShader(shader_id); glDeleteShader(shader_id);
return 0; return 0;
@@ -127,7 +131,8 @@ GLuint OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) {
std::vector<char> log(log_length); std::vector<char> log(log_length);
glGetProgramInfoLog(program, log_length, &log_length, log.data()); glGetProgramInfoLog(program, log_length, &log_length, log.data());
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Log de enlace: %s", log.data()); "Log de enlace: %s",
log.data());
} }
glDeleteProgram(program); glDeleteProgram(program);
return 0; return 0;
@@ -144,16 +149,32 @@ void OpenGLShader::createQuadGeometry() {
// Formato: x, y, u, v // Formato: x, y, u, v
float vertices[] = { float vertices[] = {
// Posición // TexCoords // Posición // TexCoords
-1.0f, -1.0f, 0.0f, 0.0f, // Inferior izquierda -1.0f,
1.0f, -1.0f, 1.0f, 0.0f, // Inferior derecha -1.0f,
1.0f, 1.0f, 1.0f, 1.0f, // Superior derecha 0.0f,
-1.0f, 1.0f, 0.0f, 1.0f // Superior izquierda 0.0f, // Inferior izquierda
1.0f,
-1.0f,
1.0f,
0.0f, // Inferior derecha
1.0f,
1.0f,
1.0f,
1.0f, // Superior derecha
-1.0f,
1.0f,
0.0f,
1.0f // Superior izquierda
}; };
// Índices para dibujar el quad con dos triángulos // Índices para dibujar el quad con dos triángulos
unsigned int indices[] = { unsigned int indices[] = {
0, 1, 2, // Primer triángulo 0,
2, 3, 0 // Segundo triángulo 1,
2, // Primer triángulo
2,
3,
0 // Segundo triángulo
}; };
// Generar y configurar VAO // Generar y configurar VAO
@@ -234,13 +255,17 @@ bool OpenGLShader::init(SDL_Window* window,
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Inicializando shaders: ventana=%dx%d, textura=%.0fx%.0f", "Inicializando shaders: ventana=%dx%d, textura=%.0fx%.0f",
window_width_, window_height_, texture_width_, texture_height_); window_width_,
window_height_,
texture_width_,
texture_height_);
// Verificar que es OpenGL // Verificar que es OpenGL
const char* renderer_name = SDL_GetRendererName(renderer_); const char* renderer_name = SDL_GetRendererName(renderer_);
if (!renderer_name || strncmp(renderer_name, "opengl", 6) != 0) { if (!renderer_name || strncmp(renderer_name, "opengl", 6) != 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Renderer no es OpenGL: %s", renderer_name ? renderer_name : "unknown"); "Renderer no es OpenGL: %s",
renderer_name ? renderer_name : "unknown");
return false; return false;
} }
@@ -293,7 +318,8 @@ bool OpenGLShader::init(SDL_Window* window,
if (texture_size_location_ != -1) { if (texture_size_location_ != -1) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Configurando TextureSize uniform: %.0fx%.0f", "Configurando TextureSize uniform: %.0fx%.0f",
texture_width_, texture_height_); texture_width_,
texture_height_);
glUniform2f(texture_size_location_, texture_width_, texture_height_); glUniform2f(texture_size_location_, texture_width_, texture_height_);
checkGLError("glUniform2f(TextureSize)"); checkGLError("glUniform2f(TextureSize)");
} else { } else {

View File

@@ -1,98 +0,0 @@
#pragma once
#include "../shader_backend.h"
#ifdef __APPLE__
#include <OpenGL/gl3.h>
#else
#include <SDL3/SDL_opengl.h>
#endif
namespace Rendering {
/**
* @brief Backend de shaders usando OpenGL 3.3 Core Profile
*
* Implementa el renderizado de shaders usando APIs modernas de OpenGL:
* - VAO (Vertex Array Objects)
* - VBO (Vertex Buffer Objects)
* - Shaders GLSL #version 330 core
*/
class OpenGLShader : public ShaderBackend {
public:
OpenGLShader() = default;
~OpenGLShader() override;
bool init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) override;
void render() override;
void setTextureSize(float width, float height) override;
void cleanup() override;
bool isHardwareAccelerated() const override { return is_initialized_; }
private:
// Funciones auxiliares
bool initGLExtensions();
GLuint compileShader(const std::string& source, GLenum shader_type);
GLuint linkProgram(GLuint vertex_shader, GLuint fragment_shader);
void createQuadGeometry();
GLuint getTextureID(SDL_Texture* texture);
void checkGLError(const char* operation);
// Estado SDL
SDL_Window* window_ = nullptr;
SDL_Renderer* renderer_ = nullptr;
SDL_Texture* back_buffer_ = nullptr;
// Estado OpenGL
GLuint program_id_ = 0;
GLuint vao_ = 0; // Vertex Array Object
GLuint vbo_ = 0; // Vertex Buffer Object
GLuint ebo_ = 0; // Element Buffer Object
// Ubicaciones de uniforms
GLint texture_size_location_ = -1;
// Tamaños
int window_width_ = 0;
int window_height_ = 0;
float texture_width_ = 0.0f;
float texture_height_ = 0.0f;
// Estado
bool is_initialized_ = false;
#ifndef __APPLE__
// Punteros a funciones OpenGL en Windows/Linux
PFNGLCREATESHADERPROC glCreateShader = nullptr;
PFNGLSHADERSOURCEPROC glShaderSource = nullptr;
PFNGLCOMPILESHADERPROC glCompileShader = nullptr;
PFNGLGETSHADERIVPROC glGetShaderiv = nullptr;
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog = nullptr;
PFNGLDELETESHADERPROC glDeleteShader = nullptr;
PFNGLATTACHSHADERPROC glAttachShader = nullptr;
PFNGLCREATEPROGRAMPROC glCreateProgram = nullptr;
PFNGLLINKPROGRAMPROC glLinkProgram = nullptr;
PFNGLVALIDATEPROGRAMPROC glValidateProgram = nullptr;
PFNGLGETPROGRAMIVPROC glGetProgramiv = nullptr;
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog = nullptr;
PFNGLUSEPROGRAMPROC glUseProgram = nullptr;
PFNGLDELETEPROGRAMPROC glDeleteProgram = nullptr;
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation = nullptr;
PFNGLUNIFORM2FPROC glUniform2f = nullptr;
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = nullptr;
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = nullptr;
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays = nullptr;
PFNGLGENBUFFERSPROC glGenBuffers = nullptr;
PFNGLBINDBUFFERPROC glBindBuffer = nullptr;
PFNGLBUFFERDATAPROC glBufferData = nullptr;
PFNGLDELETEBUFFERSPROC glDeleteBuffers = nullptr;
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer = nullptr;
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray = nullptr;
#endif
};
} // namespace Rendering

View File

@@ -0,0 +1,98 @@
#pragma once
#include "../shader_backend.hpp"
#ifdef __APPLE__
#include <OpenGL/gl3.h>
#else
#include <SDL3/SDL_opengl.h>
#endif
namespace Rendering {
/**
* @brief Backend de shaders usando OpenGL 3.3 Core Profile
*
* Implementa el renderizado de shaders usando APIs modernas de OpenGL:
* - VAO (Vertex Array Objects)
* - VBO (Vertex Buffer Objects)
* - Shaders GLSL #version 330 core
*/
class OpenGLShader : public ShaderBackend {
public:
OpenGLShader() = default;
~OpenGLShader() override;
bool init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) override;
void render() override;
void setTextureSize(float width, float height) override;
void cleanup() override;
bool isHardwareAccelerated() const override { return is_initialized_; }
private:
// Funciones auxiliares
bool initGLExtensions();
GLuint compileShader(const std::string& source, GLenum shader_type);
GLuint linkProgram(GLuint vertex_shader, GLuint fragment_shader);
void createQuadGeometry();
GLuint getTextureID(SDL_Texture* texture);
void checkGLError(const char* operation);
// Estado SDL
SDL_Window* window_ = nullptr;
SDL_Renderer* renderer_ = nullptr;
SDL_Texture* back_buffer_ = nullptr;
// Estado OpenGL
GLuint program_id_ = 0;
GLuint vao_ = 0; // Vertex Array Object
GLuint vbo_ = 0; // Vertex Buffer Object
GLuint ebo_ = 0; // Element Buffer Object
// Ubicaciones de uniforms
GLint texture_size_location_ = -1;
// Tamaños
int window_width_ = 0;
int window_height_ = 0;
float texture_width_ = 0.0f;
float texture_height_ = 0.0f;
// Estado
bool is_initialized_ = false;
#ifndef __APPLE__
// Punteros a funciones OpenGL en Windows/Linux
PFNGLCREATESHADERPROC glCreateShader = nullptr;
PFNGLSHADERSOURCEPROC glShaderSource = nullptr;
PFNGLCOMPILESHADERPROC glCompileShader = nullptr;
PFNGLGETSHADERIVPROC glGetShaderiv = nullptr;
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog = nullptr;
PFNGLDELETESHADERPROC glDeleteShader = nullptr;
PFNGLATTACHSHADERPROC glAttachShader = nullptr;
PFNGLCREATEPROGRAMPROC glCreateProgram = nullptr;
PFNGLLINKPROGRAMPROC glLinkProgram = nullptr;
PFNGLVALIDATEPROGRAMPROC glValidateProgram = nullptr;
PFNGLGETPROGRAMIVPROC glGetProgramiv = nullptr;
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog = nullptr;
PFNGLUSEPROGRAMPROC glUseProgram = nullptr;
PFNGLDELETEPROGRAMPROC glDeleteProgram = nullptr;
PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation = nullptr;
PFNGLUNIFORM2FPROC glUniform2f = nullptr;
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = nullptr;
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = nullptr;
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays = nullptr;
PFNGLGENBUFFERSPROC glGenBuffers = nullptr;
PFNGLBINDBUFFERPROC glBindBuffer = nullptr;
PFNGLBUFFERDATAPROC glBufferData = nullptr;
PFNGLDELETEBUFFERSPROC glDeleteBuffers = nullptr;
PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer = nullptr;
PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray = nullptr;
#endif
};
} // namespace Rendering

View File

@@ -1,55 +0,0 @@
#pragma once
#include <SDL3/SDL.h>
#include <string>
namespace Rendering {
/**
* @brief Interfaz abstracta para backends de renderizado con shaders
*
* Esta interfaz define el contrato que todos los backends de shaders
* deben cumplir (OpenGL, Metal, Vulkan, etc.)
*/
class ShaderBackend {
public:
virtual ~ShaderBackend() = default;
/**
* @brief Inicializa el backend de shaders
* @param window Ventana SDL
* @param texture Textura de backbuffer a la que aplicar shaders
* @param vertex_source Código fuente del vertex shader
* @param fragment_source Código fuente del fragment shader
* @return true si la inicialización fue exitosa
*/
virtual bool init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) = 0;
/**
* @brief Renderiza la textura con los shaders aplicados
*/
virtual void render() = 0;
/**
* @brief Establece el tamaño de la textura como parámetro del shader
* @param width Ancho de la textura
* @param height Alto de la textura
*/
virtual void setTextureSize(float width, float height) = 0;
/**
* @brief Limpia y libera recursos del backend
*/
virtual void cleanup() = 0;
/**
* @brief Verifica si el backend está usando aceleración por hardware
* @return true si usa aceleración (OpenGL/Metal/Vulkan)
*/
virtual bool isHardwareAccelerated() const = 0;
};
} // namespace Rendering

View File

@@ -0,0 +1,56 @@
#pragma once
#include <SDL3/SDL.h>
#include <string>
namespace Rendering {
/**
* @brief Interfaz abstracta para backends de renderizado con shaders
*
* Esta interfaz define el contrato que todos los backends de shaders
* deben cumplir (OpenGL, Metal, Vulkan, etc.)
*/
class ShaderBackend {
public:
virtual ~ShaderBackend() = default;
/**
* @brief Inicializa el backend de shaders
* @param window Ventana SDL
* @param texture Textura de backbuffer a la que aplicar shaders
* @param vertex_source Código fuente del vertex shader
* @param fragment_source Código fuente del fragment shader
* @return true si la inicialización fue exitosa
*/
virtual bool init(SDL_Window* window,
SDL_Texture* texture,
const std::string& vertex_source,
const std::string& fragment_source) = 0;
/**
* @brief Renderiza la textura con los shaders aplicados
*/
virtual void render() = 0;
/**
* @brief Establece el tamaño de la textura como parámetro del shader
* @param width Ancho de la textura
* @param height Alto de la textura
*/
virtual void setTextureSize(float width, float height) = 0;
/**
* @brief Limpia y libera recursos del backend
*/
virtual void cleanup() = 0;
/**
* @brief Verifica si el backend está usando aceleración por hardware
* @return true si usa aceleración (OpenGL/Metal/Vulkan)
*/
virtual bool isHardwareAccelerated() const = 0;
};
} // namespace Rendering

View File

@@ -1,4 +1,4 @@
#include "resource.h" #include "resource.hpp"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_SetRenderDrawColor, SDL_EventType, SDL_PollEvent, SDL_RenderFillRect, SDL_RenderRect, SDLK_ESCAPE, SDL_Event #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_SetRenderDrawColor, SDL_EventType, SDL_PollEvent, SDL_RenderFillRect, SDL_RenderRect, SDLK_ESCAPE, SDL_Event
@@ -10,14 +10,14 @@
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <utility> // Para move #include <utility> // Para move
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound #include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "param.h" // Para Param, param, ParamResource, ParamGame #include "param.hpp" // Para Param, param, ParamResource, ParamGame
#include "resource_helper.h" // Para ResourceHelper #include "resource_helper.hpp" // Para ResourceHelper
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "text.h" // Para Text #include "text.hpp" // Para Text
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH #include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
struct JA_Music_t; // lines 11-11 struct JA_Music_t; // lines 11-11

View File

@@ -8,10 +8,10 @@
#include <utility> // Para move #include <utility> // Para move
#include <vector> // Para vector #include <vector> // Para vector
#include "animated_sprite.h" // Para AnimationsFileBuffer #include "animated_sprite.hpp" // Para AnimationsFileBuffer
#include "text.h" // Para Text, TextFile #include "demo.hpp" // Para DemoData
#include "texture.h" // Para Texture #include "text.hpp" // Para Text, TextFile
#include "demo.h" // Para DemoData #include "texture.hpp" // Para Texture
struct JA_Music_t; struct JA_Music_t;
struct JA_Sound_t; struct JA_Sound_t;

View File

@@ -1,4 +1,4 @@
#include "resource_helper.h" #include "resource_helper.hpp"
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>

View File

@@ -6,7 +6,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "resource_loader.h" #include "resource_loader.hpp"
// Helper functions para integrar ResourceLoader con el sistema existente // Helper functions para integrar ResourceLoader con el sistema existente
namespace ResourceHelper { namespace ResourceHelper {

View File

@@ -1,4 +1,4 @@
#include "resource_loader.h" #include "resource_loader.hpp"
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>

View File

@@ -3,7 +3,7 @@
#include <memory> #include <memory>
#include "resource_pack.h" #include "resource_pack.hpp"
class ResourceLoader { class ResourceLoader {
private: private:

View File

@@ -1,4 +1,4 @@
#include "resource_pack.h" #include "resource_pack.hpp"
#include <algorithm> #include <algorithm>
#include <filesystem> #include <filesystem>

View File

@@ -1,4 +1,4 @@
#include "scoreboard.h" #include "scoreboard.hpp"
#include <SDL3/SDL.h> // Para SDL_DestroyTexture, SDL_SetRenderDrawColor, SDL_SetRenderTarget, SDL_CreateTexture, SDL_GetRenderTarget, SDL_GetTicks, SDL_RenderClear, SDL_RenderLine, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_FRect, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Texture, SDL_TextureAccess #include <SDL3/SDL.h> // Para SDL_DestroyTexture, SDL_SetRenderDrawColor, SDL_SetRenderTarget, SDL_CreateTexture, SDL_GetRenderTarget, SDL_GetTicks, SDL_RenderClear, SDL_RenderLine, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_FRect, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Texture, SDL_TextureAccess
@@ -7,16 +7,16 @@
#include <iomanip> // Para operator<<, setfill, setw #include <iomanip> // Para operator<<, setfill, setw
#include <sstream> // Para basic_ostream, basic_ostringstream, basic_ostream::operator<<, ostringstream #include <sstream> // Para basic_ostream, basic_ostringstream, basic_ostream::operator<<, ostringstream
#include "color.h" #include "color.hpp"
#include "enter_name.h" // Para NAME_SIZE #include "enter_name.hpp" // Para NAME_SIZE
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "param.h" // Para Param, ParamScoreboard, param #include "param.hpp" // Para Param, ParamScoreboard, param
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "text.h" // Para Text, Text::CENTER, Text::COLOR #include "text.hpp" // Para Text, Text::CENTER, Text::COLOR
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "utils.h" // Para easeOutCubic #include "utils.hpp" // Para easeOutCubic
// .at(SINGLETON) Hay que definir las variables estáticas, desde el .h sólo la hemos declarado // .at(SINGLETON) Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Scoreboard* Scoreboard::instance = nullptr; Scoreboard* Scoreboard::instance = nullptr;
@@ -447,21 +447,17 @@ void Scoreboard::renderScoreToEnterNameMode(size_t panel_index) {
// ========== Texto que SALE hacia arriba ========== // ========== Texto que SALE hacia arriba ==========
// name_ (sale desde ROW1 hacia arriba) // name_ (sale desde ROW1 hacia arriba)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y - t * delta_1_to_2, text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y - t * delta_1_to_2, name_.at(panel_index), 1, text_color1_);
name_.at(panel_index), 1, text_color1_);
// ========== Textos que SE MUEVEN hacia arriba ========== // ========== Textos que SE MUEVEN hacia arriba ==========
// score_ (se mueve de ROW2 a ROW1) // score_ (se mueve de ROW2 a ROW1)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_2_.x, slot4_2_.y - t * delta_1_to_2, text_->writeDX(Text::CENTER | Text::COLOR, slot4_2_.x, slot4_2_.y - t * delta_1_to_2, updateScoreText(score_.at(panel_index)), 1, text_color2_);
updateScoreText(score_.at(panel_index)), 1, text_color2_);
// "ENTER NAME" (se mueve de ROW3 a ROW2) // "ENTER NAME" (se mueve de ROW3 a ROW2)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_3_.x, slot4_3_.y - t * delta_2_to_3, text_->writeDX(Text::CENTER | Text::COLOR, slot4_3_.x, slot4_3_.y - t * delta_2_to_3, Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
// enter_name_ (se mueve de ROW4 a ROW3) // enter_name_ (se mueve de ROW4 a ROW3)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_4_.x, slot4_4_.y - t * delta_3_to_4, text_->writeDX(Text::CENTER | Text::COLOR, slot4_4_.x, slot4_4_.y - t * delta_3_to_4, enter_name_.at(panel_index), 1, text_color2_);
enter_name_.at(panel_index), 1, text_color2_);
// ========== Elemento que ENTRA desde abajo ========== // ========== Elemento que ENTRA desde abajo ==========
// CARRUSEL (entra desde debajo de ROW4 hacia ROW4) // CARRUSEL (entra desde debajo de ROW4 hacia ROW4)
@@ -505,21 +501,17 @@ void Scoreboard::renderEnterToShowNameMode(size_t panel_index) {
// ========== Texto que ENTRA desde arriba ========== // ========== Texto que ENTRA desde arriba ==========
// name_ (entra desde arriba hacia ROW1) // name_ (entra desde arriba hacia ROW1)
// Debe venir desde donde estaría ROW0, que está a delta_1_to_2 píxeles arriba de ROW1 // Debe venir desde donde estaría ROW0, que está a delta_1_to_2 píxeles arriba de ROW1
text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y + t * delta_1_to_2 - delta_1_to_2, text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y + t * delta_1_to_2 - delta_1_to_2, name_.at(panel_index), 1, text_color1_);
name_.at(panel_index), 1, text_color1_);
// ========== Textos que SE MUEVEN (renderizar UNA sola vez) ========== // ========== Textos que SE MUEVEN (renderizar UNA sola vez) ==========
// SCORE (se mueve de ROW1 a ROW2) // SCORE (se mueve de ROW1 a ROW2)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y + t * delta_1_to_2, text_->writeDX(Text::CENTER | Text::COLOR, slot4_1_.x, slot4_1_.y + t * delta_1_to_2, updateScoreText(score_.at(panel_index)), 1, text_color2_);
updateScoreText(score_.at(panel_index)), 1, text_color2_);
// "ENTER NAME" (se mueve de ROW2 a ROW3) // "ENTER NAME" (se mueve de ROW2 a ROW3)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_2_.x, slot4_2_.y + t * delta_2_to_3, text_->writeDX(Text::CENTER | Text::COLOR, slot4_2_.x, slot4_2_.y + t * delta_2_to_3, Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
// enter_name_ (se mueve de ROW3 a ROW4) // enter_name_ (se mueve de ROW3 a ROW4)
text_->writeDX(Text::CENTER | Text::COLOR, slot4_3_.x, slot4_3_.y + t * delta_3_to_4, text_->writeDX(Text::CENTER | Text::COLOR, slot4_3_.x, slot4_3_.y + t * delta_3_to_4, enter_name_.at(panel_index), 1, text_color2_);
enter_name_.at(panel_index), 1, text_color2_);
// ========== Elemento que SALE hacia abajo ========== // ========== Elemento que SALE hacia abajo ==========
// CARRUSEL (sale desde ROW4 hacia abajo, fuera de pantalla) // CARRUSEL (sale desde ROW4 hacia abajo, fuera de pantalla)

View File

@@ -11,7 +11,7 @@
// Forward declarations // Forward declarations
class EnterName; class EnterName;
#include "color.h" // Para Color #include "color.hpp" // Para Color
class Sprite; class Sprite;
class Text; class Text;

View File

@@ -1,4 +1,4 @@
#include "screen.h" #include "screen.hpp"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_LogCategory, SDL_LogInfo, SDL_RenderTexture, SDL_SetRenderDrawColor, SDL_SetRenderVSync, SDL_GetError, SDL_LogError, SDL_RendererLogicalPresentation, SDL_SetRenderLogicalPresentation, SDL_CreateTexture, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetTicks, SDL_Quit, SDL_RENDERER_VSYNC_DISABLED, SDL_RenderClear, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DisplayID, SDL_FRect, SDL_GetCurrentDisplayMode, SDL_GetDisplayName, SDL_GetDisplays, SDL_GetRenderTarget, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_Init, SDL_LogWarn, SDL_PixelFormat, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetHint, SDL_SetRenderDrawBlendMode, SDL_SetTextureScaleMode, SDL_SetWindowFullscreen, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_TextureAccess, SDL_free, SDL_BLENDMODE_BLEND, SDL_HINT_RENDER_DRIVER, SDL_INIT_VIDEO, SDL_PRIu32, SDL_ScaleMode, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WindowFlags #include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_LogCategory, SDL_LogInfo, SDL_RenderTexture, SDL_SetRenderDrawColor, SDL_SetRenderVSync, SDL_GetError, SDL_LogError, SDL_RendererLogicalPresentation, SDL_SetRenderLogicalPresentation, SDL_CreateTexture, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetTicks, SDL_Quit, SDL_RENDERER_VSYNC_DISABLED, SDL_RenderClear, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DisplayID, SDL_FRect, SDL_GetCurrentDisplayMode, SDL_GetDisplayName, SDL_GetDisplays, SDL_GetRenderTarget, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_Init, SDL_LogWarn, SDL_PixelFormat, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetHint, SDL_SetRenderDrawBlendMode, SDL_SetTextureScaleMode, SDL_SetWindowFullscreen, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_TextureAccess, SDL_free, SDL_BLENDMODE_BLEND, SDL_HINT_RENDER_DRIVER, SDL_INIT_VIDEO, SDL_PRIu32, SDL_ScaleMode, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WindowFlags
@@ -8,16 +8,16 @@
#include <memory> // Para allocator, shared_ptr, make_shared, __shared_ptr_access #include <memory> // Para allocator, shared_ptr, make_shared, __shared_ptr_access
#include <string> // Para operator+, char_traits, to_string, string #include <string> // Para operator+, char_traits, to_string, string
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "mouse.h" // Para updateCursorVisibility #include "mouse.hpp" // Para updateCursorVisibility
#include "rendering/opengl/opengl_shader.h" // Para OpenGLShader #include "options.hpp" // Para VideoOptions, video, WindowOptions, window
#include "options.h" // Para VideoOptions, video, WindowOptions, window #include "param.hpp" // Para Param, param, ParamGame, ParamDebug
#include "param.h" // Para Param, param, ParamGame, ParamDebug #include "rendering/opengl/opengl_shader.hpp" // Para OpenGLShader
#include "text.h" // Para Text, Text::COLOR, Text::STROKE #include "text.hpp" // Para Text, Text::COLOR, Text::STROKE
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.h" // Para Zone #include "utils.hpp" // Para Zone
// Singleton // Singleton
Screen* Screen::instance = nullptr; Screen* Screen::instance = nullptr;

View File

@@ -5,8 +5,8 @@
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string #include <string> // Para string
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "options.h" // Para VideoOptions, video #include "options.hpp" // Para VideoOptions, video
// Forward declarations // Forward declarations
class Notifier; class Notifier;

View File

@@ -1,5 +1,5 @@
// IWYU pragma: no_include <bits/std_abs.h> // IWYU pragma: no_include <bits/std_abs.h>
#include "credits.h" #include "credits.hpp"
#include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_RenderTexture, SDL_SetRenderTarget, SDL_SetRenderDrawColor, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetTicks, SDL_GetRenderTarget, SDL_PixelFormat, SDL_PollEvent, SDL_RenderClear, SDL_RenderRect, SDL_SetTextureBlendMode, SDL_TextureAccess, SDL_BLENDMODE_BLEND, SDL_Event #include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_RenderTexture, SDL_SetRenderTarget, SDL_SetRenderDrawColor, SDL_CreateTexture, SDL_DestroyTexture, SDL_GetTicks, SDL_GetRenderTarget, SDL_PixelFormat, SDL_PollEvent, SDL_RenderClear, SDL_RenderRect, SDL_SetTextureBlendMode, SDL_TextureAccess, SDL_BLENDMODE_BLEND, SDL_Event
@@ -10,25 +10,25 @@
#include <string_view> // Para string_view #include <string_view> // Para string_view
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.hpp" // Para BalloonManager
#include "color.h" // Para Zone, Colors::SHADOW_TEXT, Colors::NO_COLOR_MOD, Color #include "color.hpp" // Para Zone, Colors::SHADOW_TEXT, Colors::NO_COLOR_MOD, Color
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.hpp" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check #include "global_events.hpp" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.hpp" // Para check
#include "input.h" // Para Input, Input::ALLOW_REPEAT #include "input.hpp" // Para Input, Input::ALLOW_REPEAT
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "param.h" // Para Param, param, ParamGame, ParamFade #include "param.hpp" // Para Param, param, ParamGame, ParamFade
#include "player.h" // Para Player, PlayerState #include "player.hpp" // Para Player, PlayerState
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name #include "section.hpp" // Para Name, name
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "text.h" // Para Text, Text::CENTER, Text::SHADOW #include "text.hpp" // Para Text, Text::CENTER, Text::SHADOW
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.hpp" // Para TiledBG, TiledBGMode
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.h" #include "utils.hpp"
// Textos // Textos
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner"; constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";

View File

@@ -5,10 +5,10 @@
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "color.h" // Para Zone, Color #include "color.hpp" // Para Zone, Color
#include "options.h" // Para AudioOptions, MusicOptions, audio #include "options.hpp" // Para AudioOptions, MusicOptions, audio
#include "param.h" // Para Param, ParamGame, param #include "param.hpp" // Para Param, ParamGame, param
#include "utils.h" #include "utils.hpp"
// Declaraciones adelantadas // Declaraciones adelantadas
class BalloonManager; class BalloonManager;

View File

@@ -1,4 +1,4 @@
#include "game.h" #include "game.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_EventType, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_Event, SDL_PixelFormat, SDL_Point, SDL_TextureAccess #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_EventType, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_Event, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
@@ -11,42 +11,42 @@
#include <random> // std::random_device, std::default_random_engine #include <random> // std::random_device, std::default_random_engine
#include <utility> // Para move #include <utility> // Para move
#include "asset.h" // Para Asset #include "asset.hpp" // Para Asset
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "background.h" // Para Background #include "background.hpp" // Para Background
#include "balloon.h" // Para Balloon #include "balloon.hpp" // Para Balloon
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.hpp" // Para BalloonManager
#include "bullet.h" // Para Bullet, Bullet::Type, BulletMoveStatus #include "bullet.hpp" // Para Bullet, Bullet::Type, BulletMoveStatus
#include "bullet_manager.h" // Para BulletManager #include "bullet_manager.hpp" // Para BulletManager
#include "color.h" // Para Color, Colors::FLASH #include "color.hpp" // Para Color, Colors::FLASH
#include "difficulty.h" // Para Code #include "difficulty.hpp" // Para Code
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.hpp" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check #include "global_events.hpp" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.hpp" // Para check
#include "hit.h" // Para Hit #include "hit.hpp" // Para Hit
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "input_types.h" // Para InputAction #include "input_types.hpp" // Para InputAction
#include "item.h" // Para Item, ItemType #include "item.hpp" // Para Item, ItemType
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "manage_hiscore_table.h" // Para HiScoreEntry, ManageHiScoreTable #include "manage_hiscore_table.hpp" // Para HiScoreEntry, ManageHiScoreTable
#include "param.h" // Para Param, param, ParamGame, ParamScoreboard, ParamFade, ParamBalloon #include "param.hpp" // Para Param, param, ParamGame, ParamScoreboard, ParamFade, ParamBalloon
#include "path_sprite.h" // Para Path, PathSprite, createPath, PathType #include "path_sprite.hpp" // Para Path, PathSprite, createPath, PathType
#include "pause_manager.h" // Para PauseManager #include "pause_manager.hpp" // Para PauseManager
#include "player.h" // Para Player #include "player.hpp" // Para Player
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "scoreboard.h" // Para Scoreboard #include "scoreboard.hpp" // Para Scoreboard
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name, AttractMode, Options, attract_mode, options #include "section.hpp" // Para Name, name, AttractMode, Options, attract_mode, options
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.hpp" // Para SmartSprite
#include "stage.h" // Para number, Stage, get, total_power, power, init, power_can_be_added, stages #include "stage.hpp" // Para number, Stage, get, total_power, power, init, power_can_be_added, stages
#include "tabe.h" // Para Tabe #include "tabe.hpp" // Para Tabe
#include "text.h" // Para Text #include "text.hpp" // Para Text
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.hpp" // Para ServiceMenu
#ifdef _DEBUG #ifdef _DEBUG
#include <iostream> // Para std::cout #include <iostream> // Para std::cout
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.hpp" // Para Notifier
#endif #endif
// Constructor // Constructor

View File

@@ -6,18 +6,18 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "bullet.h" // Para Bullet #include "bullet.hpp" // Para Bullet
#include "bullet_manager.h" // Para BulletManager #include "bullet_manager.hpp" // Para BulletManager
#include "hit.h" // Para Hit #include "demo.hpp" // Para Demo
#include "item.h" // Para Item, ItemType #include "hit.hpp" // Para Hit
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "item.hpp" // Para Item, ItemType
#include "options.h" // Para Settings, settings #include "manage_hiscore_table.hpp" // Para HiScoreEntry
#include "path_sprite.h" // Para PathSprite, Path #include "options.hpp" // Para Settings, settings
#include "player.h" // Para Player #include "path_sprite.hpp" // Para PathSprite, Path
#include "smart_sprite.h" // Para SmartSprite #include "player.hpp" // Para Player
#include "stage.h" // Para StageManager #include "smart_sprite.hpp" // Para SmartSprite
#include "demo.h" // Para Demo #include "stage.hpp" // Para StageManager
#include "utils.h" // Para otras utilidades #include "utils.hpp" // Para otras utilidades
class Background; class Background;
class Balloon; class Balloon;

View File

@@ -1,4 +1,4 @@
#include "hiscore_table.h" #include "hiscore_table.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget
@@ -7,25 +7,25 @@
#include <functional> // Para function #include <functional> // Para function
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "background.h" // Para Background #include "background.hpp" // Para Background
#include "color.h" // Para Color, easeOutQuint, Colors::NO_COLOR_MOD #include "color.hpp" // Para Color, easeOutQuint, Colors::NO_COLOR_MOD
#include "fade.h" // Para Fade, FadeMode, FadeType #include "fade.hpp" // Para Fade, FadeMode, FadeType
#include "global_events.h" // Para check #include "global_events.hpp" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.hpp" // Para check
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "manage_hiscore_table.hpp" // Para HiScoreEntry
#include "options.h" // Para SettingsOptions, settings #include "options.hpp" // Para SettingsOptions, settings
#include "param.h" // Para Param, param, ParamGame, ParamFade #include "param.hpp" // Para Param, param, ParamGame, ParamFade
#include "path_sprite.h" // Para PathSprite, Path, PathType #include "path_sprite.hpp" // Para PathSprite, Path, PathType
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name, Options, options #include "section.hpp" // Para Name, name, Options, options
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "text.h" // Para Text, Text::SHADOW, Text::COLOR #include "text.hpp" // Para Text, Text::SHADOW, Text::COLOR
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "utils.h" #include "utils.hpp"
// Constructor // Constructor
HiScoreTable::HiScoreTable() HiScoreTable::HiScoreTable()

View File

@@ -6,9 +6,9 @@
#include <string> // Para string #include <string> // Para string
#include <vector> // Para vector #include <vector> // Para vector
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "fade.h" // Para Fade #include "fade.hpp" // Para Fade
#include "path_sprite.h" // Para Path, PathSprite (ptr only) #include "path_sprite.hpp" // Para Path, PathSprite (ptr only)
class Background; class Background;
class Sprite; class Sprite;

View File

@@ -1,4 +1,4 @@
#include "instructions.h" #include "instructions.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_Re... #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_Re...
@@ -8,22 +8,22 @@
#include <utility> // Para move #include <utility> // Para move
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "color.h" // Para Color, Colors::SHADOW_TEXT, Zone, NO_TEXT_C... #include "color.hpp" // Para Color, Colors::SHADOW_TEXT, Zone, NO_TEXT_C...
#include "fade.h" // Para Fade, FadeMode, FadeType #include "fade.hpp" // Para Fade, FadeMode, FadeType
#include "global_events.h" // Para check #include "global_events.hpp" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.hpp" // Para check
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "item.h" // Para Item #include "item.hpp" // Para Item
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "param.h" // Para Param, param, ParamGame, ParamFade, Param... #include "param.hpp" // Para Param, param, ParamGame, ParamFade, Param...
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name, Options, options #include "section.hpp" // Para Name, name, Options, options
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
#include "text.h" // Para Text, Text::CENTER, Text::COLOR, Text::SHADOW #include "text.hpp" // Para Text, Text::CENTER, Text::COLOR, Text::SHADOW
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.hpp" // Para TiledBG, TiledBGMode
#include "utils.h" #include "utils.hpp"
// Constructor // Constructor
Instructions::Instructions() Instructions::Instructions()

View File

@@ -5,7 +5,7 @@
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "sprite.h" // Para Sprite #include "sprite.hpp" // Para Sprite
class Fade; class Fade;
class Text; class Text;

View File

@@ -1,4 +1,4 @@
#include "intro.h" #include "intro.hpp"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDL_Event, Uint32 #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDL_Event, Uint32
@@ -8,22 +8,22 @@
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include <utility> // Para move #include <utility> // Para move
#include "audio.h" // Para Audio #include "audio.hpp" // Para Audio
#include "color.h" // Para Color #include "color.hpp" // Para Color
#include "global_events.h" // Para check #include "global_events.hpp" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.hpp" // Para check
#include "input.h" // Para Input #include "input.hpp" // Para Input
#include "lang.h" // Para getText #include "lang.hpp" // Para getText
#include "param.h" // Para Param, param, ParamGame, ParamIntro, ParamTitle #include "param.hpp" // Para Param, param, ParamGame, ParamIntro, ParamTitle
#include "path_sprite.h" // Para PathSprite, PathType #include "path_sprite.hpp" // Para PathSprite, PathType
#include "resource.h" // Para Resource #include "resource.hpp" // Para Resource
#include "screen.h" // Para Screen #include "screen.hpp" // Para Screen
#include "section.hpp" // Para Name, name, Options, options #include "section.hpp" // Para Name, name, Options, options
#include "text.h" // Para Text #include "text.hpp" // Para Text
#include "texture.h" // Para Texture #include "texture.hpp" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.hpp" // Para TiledBG, TiledBGMode
#include "utils.h" // Para Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint #include "utils.hpp" // Para Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint
#include "writer.h" // Para Writer #include "writer.hpp" // Para Writer
// Constructor // Constructor
Intro::Intro() Intro::Intro()

Some files were not shown because too many files have changed in this diff Show More