creat color.h i color.cpp i llevat de utils.h i utils.cpp

This commit is contained in:
2025-07-21 14:43:35 +02:00
parent 087643c71b
commit 8b7b667c60
70 changed files with 529 additions and 570 deletions

View File

@@ -18,24 +18,24 @@ set(OpenGL_GL_PREFERENCE GLVND)
# --- 1. LISTA EXPLÍCITA DE FUENTES --- # --- 1. LISTA EXPLÍCITA DE FUENTES ---
set(APP_SOURCES set(APP_SOURCES
# --- Archivos Principales del Sistema --- # --- Archivos Principales del Sistema ---
source/main.cpp
source/director.cpp
source/screen.cpp
source/resource.cpp
source/asset.cpp source/asset.cpp
source/audio.cpp source/audio.cpp
source/input.cpp source/director.cpp
source/options.cpp
source/lang.cpp
source/param.cpp
source/utils.cpp
source/global_events.cpp source/global_events.cpp
source/global_inputs.cpp source/global_inputs.cpp
source/input.cpp
source/lang.cpp
source/main.cpp
source/param.cpp
source/resource.cpp
source/screen.cpp
source/text.cpp
source/writer.cpp
# --- UI (User Interface) --- # --- UI (User Interface) ---
source/ui/service_menu.cpp
source/ui/menu_renderer.cpp source/ui/menu_renderer.cpp
source/ui/notifier.cpp source/ui/notifier.cpp
source/ui/service_menu.cpp
source/ui/ui_message.cpp source/ui/ui_message.cpp
# --- Lógica del Juego --- # --- Lógica del Juego ---
@@ -50,6 +50,7 @@ set(APP_SOURCES
source/manage_hiscore_table.cpp source/manage_hiscore_table.cpp
source/player.cpp source/player.cpp
source/scoreboard.cpp source/scoreboard.cpp
source/tabe.cpp
# --- Escenas --- # --- Escenas ---
source/sections/credits.cpp source/sections/credits.cpp
@@ -61,23 +62,23 @@ set(APP_SOURCES
source/sections/title.cpp source/sections/title.cpp
# --- Sprites y Gráficos --- # --- Sprites y Gráficos ---
source/sprite.cpp
source/animated_sprite.cpp source/animated_sprite.cpp
source/background.cpp
source/fade.cpp
source/moving_sprite.cpp source/moving_sprite.cpp
source/path_sprite.cpp source/path_sprite.cpp
source/smart_sprite.cpp source/smart_sprite.cpp
source/background.cpp source/sprite.cpp
source/tiled_bg.cpp
source/fade.cpp
source/texture.cpp source/texture.cpp
source/tiled_bg.cpp
# --- Otros --- # --- Otros ---
source/color.cpp
source/define_buttons.cpp source/define_buttons.cpp
source/mouse.cpp source/mouse.cpp
source/options.cpp
source/stage.cpp source/stage.cpp
source/tabe.cpp source/utils.cpp
source/text.cpp
source/writer.cpp
) )
# Fuentes de librerías de terceros # Fuentes de librerías de terceros

View File

@@ -1,16 +1,15 @@
#include "animated_sprite.h" #include "animated_sprite.h"
#include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError #include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError, SDL_FRect
#include <algorithm> // Para min, max
#include <cstddef> // Para size_t
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios, ifstream, stringstream
#include <sstream> // Para basic_stringstream
#include <stdexcept> // Para runtime_error
#include <utility> // Para pair
#include <algorithm> // Para min #include "texture.h" // Para Texture
#include <cstddef> // Para size_t #include "utils.h" // Para printWithDots
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios, ifst...
#include <sstream> // Para basic_stringstream
#include <stdexcept> // Para runtime_error
#include <utility> // Para pair
#include "texture.h" // Para Texture
#include "utils.h" // 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

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect #include <SDL3/SDL.h> // Para SDL_FRect
#include <algorithm> // Para max #include <algorithm> // Para max
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <memory> // Para allocator, shared_ptr #include <memory> // Para allocator, shared_ptr

View File

@@ -1,14 +1,13 @@
#include "asset.h" #include "asset.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_LogWarn #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_LogWarn
#include <algorithm> // Para max #include <algorithm> // Para max
#include <fstream> // Para basic_ifstream, ifstream #include <fstream> // Para basic_ifstream, ifstream
#include <functional> // Para identity #include <functional> // Para identity
#include <ranges> // Para __find_if_fn, find_if #include <ranges> // Para __find_if_fn, find_if
#include <string> // Para allocator, string, operator==, operator+, char_traits, basic_string #include <string> // Para allocator, string, operator==, operator+, char_traits, basic_string
#include "utils.h" // Para getFileName #include "utils.h" // Para getFileName
// Singleton // Singleton
Asset *Asset::instance = nullptr; Asset *Asset::instance = nullptr;

View File

@@ -1,7 +1,6 @@
#include "audio.h" #include "audio.h"
#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...

View File

@@ -2,7 +2,6 @@
#include "background.h" #include "background.h"
#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
#include <algorithm> // Para clamp, max #include <algorithm> // Para clamp, max
#include <cmath> // Para M_PI, cos, sin #include <cmath> // Para M_PI, cos, sin

View File

@@ -1,13 +1,12 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_FPoint, SDL_Texture, SDL_Renderer #include <SDL3/SDL.h> // Para SDL_FRect, SDL_FPoint, SDL_Texture, SDL_Renderer
#include <array> // Para array
#include <cstddef> // Para size_t
#include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector
#include <array> #include "color.h" // Para Color
#include <cstddef> // Para size_t
#include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector
#include "utils.h" // Para Color
class MovingSprite; class MovingSprite;
class Sprite; class Sprite;

View File

@@ -1,11 +1,10 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8, Uint16, SDL_FRect, Uint32 #include <SDL3/SDL.h> // Para Uint8, Uint16, SDL_FRect, Uint32
#include <array> // Para array
#include <array> #include <memory> // Para allocator, shared_ptr, unique_ptr
#include <memory> // Para shared_ptr, unique_ptr #include <string> // Para basic_string, string
#include <string> // Para basic_string, string #include <vector> // Para vector
#include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.h" // Para Circle

View File

@@ -7,12 +7,13 @@
#include "balloon.h" // Para Balloon, BALLOON_SCORE, BALLOON_VELX... #include "balloon.h" // Para Balloon, BALLOON_SCORE, BALLOON_VELX...
#include "balloon_formations.h" // Para BalloonFormationParams, BalloonForma... #include "balloon_formations.h" // Para BalloonFormationParams, BalloonForma...
#include "color.h" // Para Zone, Color, flash_color
#include "explosions.h" // Para Explosions #include "explosions.h" // Para Explosions
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "stage.h" // Para addPower #include "stage.h" // Para addPower
#include "utils.h" // Para Zone, Color, flash_color #include "utils.h"
// Constructor // Constructor
BalloonManager::BalloonManager() BalloonManager::BalloonManager()

View File

@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect #include <SDL3/SDL.h> // Para SDL_FRect
#include <algorithm> // Para max
#include <algorithm> // Para max #include <array> // Para array
#include <array> // Para array #include <memory> // Para shared_ptr, unique_ptr
#include <memory> // Para shared_ptr, unique_ptr #include <string> // Para string
#include <string> // Para string #include <vector> // Para vector
#include <vector> // Para vector
#include "balloon.h" // Para BALLOON_SPEED, Balloon, BalloonSize (ptr only), BalloonType (ptr only) #include "balloon.h" // Para BALLOON_SPEED, Balloon, BalloonSize (ptr only), BalloonType (ptr only)
#include "balloon_formations.h" // Para BalloonFormations #include "balloon_formations.h" // Para BalloonFormations

View File

@@ -1,9 +1,8 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8 #include <SDL3/SDL.h> // Para Uint8
#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.h" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.h" // Para Circle

181
source/color.cpp Normal file
View File

@@ -0,0 +1,181 @@
#define _USE_MATH_DEFINES
#include "color.h"
#include <algorithm> // Para min, clamp
#include <cmath> // Para fmaxf, fminf, M_PI, fmodf, roundf, sin, abs
#include <stdexcept> // Para invalid_argument
#include <string> // Para basic_string, string
// Método estático para crear Color desde string hexadecimal
auto Color::fromHex(const std::string &hex_str) -> Color {
std::string hex = hex_str;
// Quitar '#' si existe
if (!hex.empty() && hex[0] == '#') {
hex = hex.substr(1);
}
// Verificar longitud válida (6 para RGB o 8 para RGBA)
if (hex.length() != HEX_RGB_LENGTH && hex.length() != HEX_RGBA_LENGTH) {
throw std::invalid_argument("String hexadecimal debe tener 6 o 8 caracteres");
}
// Verificar que todos los caracteres sean hexadecimales válidos
for (char c : hex) {
if (std::isxdigit(c) == 0) {
throw std::invalid_argument("String contiene caracteres no hexadecimales");
}
}
// Convertir cada par de caracteres a valores RGB(A)
Uint8 r = static_cast<Uint8>(std::stoi(hex.substr(0, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 g = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 b = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH * 2, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 a = DEFAULT_ALPHA; // Alpha por defecto
// Si tiene 8 caracteres, extraer el alpha
if (hex.length() == HEX_RGBA_LENGTH) {
a = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH * 3, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
}
return Color(r, g, b, a);
}
// Obtiene un color del vector de colores imitando al Coche Fantástico
auto getColorLikeKnightRider(const std::vector<Color> &colors, int counter) -> Color {
int cycle_length = colors.size() * 2 - 2;
size_t n = counter % cycle_length;
size_t index;
if (n < colors.size()) {
index = n; // Avanza: 0,1,2,3
} else {
index = 2 * (colors.size() - 1) - n; // Retrocede: 2,1
}
return colors[index];
}
constexpr auto rgbToHsv(Color color) -> HSV {
float r = color.r / 255.0F;
float g = color.g / 255.0F;
float b = color.b / 255.0F;
float max = fmaxf(fmaxf(r, g), b);
float min = fminf(fminf(r, g), b);
float delta = max - min;
float h = 0.0F;
if (delta > 0.00001F) {
if (max == r) {
h = fmodf((g - b) / delta, 6.0F);
} else if (max == g) {
h = ((b - r) / delta) + 2.0F;
} else {
h = ((r - g) / delta) + 4.0F;
}
h *= 60.0F;
if (h < 0.0F) {
h += 360.0F;
}
}
float s = (max <= 0.0F) ? 0.0F : delta / max;
float v = max;
return {h, s, v};
}
constexpr auto hsvToRgb(HSV hsv) -> Color {
float c = hsv.v * hsv.s;
float x = c * (1 - std::abs(std::fmod(hsv.h / 60.0F, 2) - 1));
float m = hsv.v - c;
float r = 0;
float g = 0;
float b = 0;
if (hsv.h < 60) {
r = c;
g = x;
b = 0;
} else if (hsv.h < 120) {
r = x;
g = c;
b = 0;
} else if (hsv.h < 180) {
r = 0;
g = c;
b = x;
} else if (hsv.h < 240) {
r = 0;
g = x;
b = c;
} else if (hsv.h < 300) {
r = x;
g = 0;
b = c;
} else {
r = c;
g = 0;
b = x;
}
return Color(
static_cast<uint8_t>(roundf((r + m) * 255)),
static_cast<uint8_t>(roundf((g + m) * 255)),
static_cast<uint8_t>(roundf((b + m) * 255)));
}
auto generateMirroredCycle(Color base, ColorCycleStyle style) -> ColorCycle {
ColorCycle result{};
HSV base_hsv = rgbToHsv(base);
for (size_t i = 0; i < COLOR_CYCLE_SIZE; ++i) {
float t = static_cast<float>(i) / (COLOR_CYCLE_SIZE - 1); // 0 → 1
float hue_shift = 0.0F;
float sat_shift = 0.0F;
float val_shift = 0.0F;
switch (style) {
case ColorCycleStyle::SUBTLE_PULSE:
// Solo brillo suave
val_shift = 0.07F * sinf(t * M_PI);
break;
case ColorCycleStyle::HUE_WAVE:
// Oscilación leve de tono
hue_shift = 15.0F * (t - 0.5F) * 2.0F;
val_shift = 0.05F * sinf(t * M_PI);
break;
case ColorCycleStyle::VIBRANT:
// Cambios fuertes en tono y brillo
hue_shift = 35.0F * sinf(t * M_PI);
val_shift = 0.2F * sinf(t * M_PI);
sat_shift = -0.2F * sinf(t * M_PI);
break;
case ColorCycleStyle::DARKEN_GLOW:
// Se oscurece al centro
val_shift = -0.15F * sinf(t * M_PI);
break;
case ColorCycleStyle::LIGHT_FLASH:
// Se ilumina al centro
val_shift = 0.25F * sinf(t * M_PI);
break;
}
HSV adjusted = {
fmodf(base_hsv.h + hue_shift + 360.0F, 360.0F),
fminf(1.0F, fmaxf(0.0F, base_hsv.s + sat_shift)),
fminf(1.0F, fmaxf(0.0F, base_hsv.v + val_shift))};
Color c = hsvToRgb(adjusted);
result[i] = c;
result[2 * COLOR_CYCLE_SIZE - 1 - i] = c; // espejo
}
return result;
}

116
source/color.h Normal file
View File

@@ -0,0 +1,116 @@
#pragma once
#include <SDL3/SDL.h> // Para Uint8
#include <algorithm> // Para max, min
#include <array> // Para array
#include <cctype> // Para isxdigit
#include <cstdlib> // Para abs
#include <stdexcept> // Para invalid_argument
#include <string> // Para string, basic_string, stoi
#include <vector> // Para vector
// --- Constantes ---
constexpr size_t COLOR_CYCLE_SIZE = 6; // Mitad del ciclo espejado
// --- Estructuras y tipos ---
// Estructura para definir un color RGBA
struct Color {
private:
static constexpr Uint8 MAX_COLOR_VALUE = 255;
static constexpr Uint8 MIN_COLOR_VALUE = 0;
static constexpr Uint8 DEFAULT_ALPHA = 255;
static constexpr int DEFAULT_LIGHTEN_AMOUNT = 50;
static constexpr int DEFAULT_DARKEN_AMOUNT = 50;
static constexpr int DEFAULT_APPROACH_STEP = 1;
static constexpr size_t HEX_RGB_LENGTH = 6;
static constexpr size_t HEX_RGBA_LENGTH = 8;
static constexpr int HEX_BASE = 16;
static constexpr size_t HEX_COMPONENT_LENGTH = 2;
public:
Uint8 r, g, b, a;
constexpr Color() : r(MIN_COLOR_VALUE), g(MIN_COLOR_VALUE), b(MIN_COLOR_VALUE), a(DEFAULT_ALPHA) {}
explicit constexpr Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = DEFAULT_ALPHA)
: r(red), g(green), b(blue), a(alpha) {}
[[nodiscard]] constexpr auto INVERSE() const -> Color {
return Color(MAX_COLOR_VALUE - r, MAX_COLOR_VALUE - g, MAX_COLOR_VALUE - b, a);
}
[[nodiscard]] constexpr auto LIGHTEN(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color {
return Color(
std::min(static_cast<int>(MAX_COLOR_VALUE), r + amount),
std::min(static_cast<int>(MAX_COLOR_VALUE), g + amount),
std::min(static_cast<int>(MAX_COLOR_VALUE), b + amount),
a);
}
[[nodiscard]] constexpr auto DARKEN(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color {
return Color(
std::max(static_cast<int>(MIN_COLOR_VALUE), r - amount),
std::max(static_cast<int>(MIN_COLOR_VALUE), g - amount),
std::max(static_cast<int>(MIN_COLOR_VALUE), b - amount),
a);
}
// Método estático para crear Color desde string hexadecimal
static auto fromHex(const std::string &hex_str) -> Color;
[[nodiscard]] constexpr auto IS_EQUAL_TO(const Color &other) const -> bool {
return r == other.r && g == other.g && b == other.b && a == other.a;
}
[[nodiscard]] constexpr auto APPROACH_TO(const Color &target, int step = DEFAULT_APPROACH_STEP) const -> Color {
auto approach_component = [step](Uint8 current, Uint8 target_val) -> Uint8 {
if (std::abs(current - target_val) <= step) {
return target_val;
}
return (current < target_val) ? current + step : current - step;
};
Uint8 new_r = approach_component(r, target.r);
Uint8 new_g = approach_component(g, target.g);
Uint8 new_b = approach_component(b, target.b);
Uint8 new_a = approach_component(a, target.a);
return Color(new_r, new_g, new_b, new_a);
}
};
// Estructura para definir un color HSV
struct HSV {
float h, s, v;
};
// Estructura para definir el ciclo de color
enum class ColorCycleStyle {
SUBTLE_PULSE, // Variación leve en brillo (por defecto)
HUE_WAVE, // Variación suave en tono (sin verde)
VIBRANT, // Cambios agresivos en tono y brillo
DARKEN_GLOW, // Oscurece hacia el centro y regresa
LIGHT_FLASH // Ilumina hacia el centro y regresa
};
// --- Alias ---
using ColorCycle = std::array<Color, 2 * COLOR_CYCLE_SIZE>;
// --- Colores predefinidos ---
constexpr Color NO_TEXT_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color SHADOW_TEXT_COLOR = Color(0X43, 0X43, 0X4F);
constexpr Color TITLE_SHADOW_TEXT_COLOR = Color(0x14, 0x87, 0xc4);
constexpr Color FLASH_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color BLUE_SKY_COLOR = Color(0X02, 0X88, 0XD1);
constexpr Color PINK_SKY_COLOR = Color(0XFF, 0X6B, 0X97);
constexpr Color GREEN_SKY_COLOR = Color(0X00, 0X79, 0X6B);
// --- Funciones ---
auto getColorLikeKnightRider(const std::vector<Color> &colors, int counter) -> Color;
constexpr auto rgbToHsv(Color color) -> HSV;
constexpr auto hsvToRgb(HSV hsv) -> Color;
auto generateMirroredCycle(Color base, ColorCycleStyle style = ColorCycleStyle::SUBTLE_PULSE) -> ColorCycle;

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_Event, SDL_GamepadButtonEvent #include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_Event, SDL_GamepadButtonEvent
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para basic_string, string #include <string> // Para basic_string, string

View File

@@ -1,33 +1,32 @@
// IWYU pragma: no_include <bits/chrono.h> // IWYU pragma: no_include <bits/chrono.h>
#include "director.h" #include "director.h"
#include <SDL3/SDL.h> // Para SDL_Scancode, SDL_GamepadButton #include <SDL3/SDL.h> // Para SDL_Scancode, SDL_GamepadButton, SDL_LogCategory, SDL_LogInfo, SDL_SetLogPriority, SDL_LogPriority, SDL_Quit
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU #include <sys/stat.h> // Para mkdir, stat, S_IRWXU
#include <unistd.h> // Para getuid #include <unistd.h> // Para getuid
#include <algorithm> // Para min
#include <algorithm> // Para min #include <cerrno> // Para errno, EEXIST, EACCES, ENAMETOOLONG
#include <cerrno> // Para errno, EEXIST, EACCES, ENAMETOOLONG #include <cstdio> // Para printf, perror
#include <cstdio> // Para printf, perror #include <cstdlib> // Para exit, EXIT_FAILURE, size_t, srand, rand, system
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, srand #include <ctime> // Para time
#include <ctime> // Para time #include <memory> // Para make_unique, unique_ptr
#include <memory> // Para make_unique, unique_ptr #include <span> // Para span
#include <span> #include <stdexcept> // Para runtime_error
#include <stdexcept> // Para runtime_error #include <string> // Para operator+, allocator, char_traits, operator==, string, basic_string
#include <string> // Para operator+, basic_string, allocator #include <vector> // Para vector
#include <vector> // Para vector
#include "asset.h" // Para Asset, AssetType #include "asset.h" // Para Asset, AssetType
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "input.h" // Para Input, InputAction #include "input.h" // Para Input, InputAction
#include "lang.h" // Para setLanguage #include "lang.h" // Para setLanguage
#include "manage_hiscore_table.h" // Para ManageHiScoreTable #include "manage_hiscore_table.h" // Para ManageHiScoreTable
#include "options.h" // Para GamepadOptions, controllers, loa... #include "options.h" // Para GamepadOptions, controllers, loadFromFile, saveToFile, SettingsOptions, settings, getPlayerWhoUsesKeyboard, setKeyboardToPlayer
#include "param.h" // Para loadParamsFromFile #include "param.h" // Para loadParamsFromFile
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.hpp" // Para Name, Options, name, options #include "section.hpp" // Para Name, Options, name, options, AttractMode, attract_mode
#include "sections/credits.h" // Para Credits #include "sections/credits.h" // Para Credits
#include "sections/game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_M... #include "sections/game.h" // Para Game, GAME_MODE_DEMO_OFF, GAME_MODE_DEMO_ON
#include "sections/hiscore_table.h" // Para HiScoreTable #include "sections/hiscore_table.h" // Para HiScoreTable
#include "sections/instructions.h" // Para Instructions #include "sections/instructions.h" // Para Instructions
#include "sections/intro.h" // Para Intro #include "sections/intro.h" // Para Intro
@@ -38,7 +37,7 @@
#include "utils.h" // Para Overrides, overrides, getPath #include "utils.h" // Para Overrides, overrides, getPath
#ifndef _WIN32 #ifndef _WIN32
#include <pwd.h> // Para getpwuid, passwd #include <pwd.h> // Para getpwuid, passwd
#endif #endif
// Constructor // Constructor

View File

@@ -4,7 +4,7 @@
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include <string_view> // Para basic_string_view, string_view #include <string_view> // Para basic_string_view, string_view
#include "utils.h" // Para trim #include "utils.h" // Para trim
// Constructor // Constructor
EnterName::EnterName() EnterName::EnterName()

View File

@@ -2,7 +2,7 @@
#include <array> // Para array #include <array> // Para array
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <string> // Para string, basic_string #include <string> // Para allocator, string
#include "utils.h" // Para trim #include "utils.h" // Para trim

View File

@@ -1,13 +1,12 @@
#include "fade.h" #include "fade.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_FRect, SDL_GetRenderT... #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 <cstdlib> // Para rand, size_t
#include <algorithm> // Para min, max #include "color.h" // Para Color
#include <cstdlib> // Para rand, size_t #include "param.h" // Para Param, param, ParamGame, ParamFade
#include "screen.h" // Para Screen
#include "param.h" // Para Param, param, ParamGame, ParamFade
#include "screen.h" // Para Screen
#include "utils.h" // Para Color
// Constructor // Constructor
Fade::Fade() Fade::Fade()

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_Renderer, SDL_Texture, Uint16 #include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_Renderer, SDL_Texture, Uint16
#include <vector> // Para vector #include <vector> // Para vector
struct Color; struct Color;

View File

@@ -1,18 +1,17 @@
#include "game_logo.h" #include "game_logo.h"
#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.h" // Para AnimatedSprite
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "color.h" // Para Color
#include "param.h" // Para Param, param, ParamGame, ParamTitle #include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.h" // Para SmartSprite
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "utils.h" // Para Color
constexpr int ZOOM_FACTOR = 5; constexpr int ZOOM_FACTOR = 5;
constexpr int FLASH_DELAY = 3; constexpr int FLASH_DELAY = 3;

View File

@@ -1,15 +1,15 @@
#include "global_inputs.h" #include "global_inputs.h"
#include <string> // Para basic_string, operator+, allocator, cha... #include <string> // Para operator+, allocator, char_traits, to_string, string
#include <vector> // Para vector #include <vector> // Para vector
#include "asset.h" // Para Asset #include "asset.h" // Para Asset
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "input.h" // Para Input, INPUT_DO_NOT_ALLOW_REPEAT, Input... #include "input.h" // Para Input, INPUT_DO_NOT_ALLOW_REPEAT, InputAction, InputDevice
#include "lang.h" // Para getText, Code, getNextLangCode, loadFro... #include "lang.h" // Para getText, Code, getNextLangCode, loadFromFile
#include "options.h" // Para SettingsOptions, settings, VideoOptions #include "options.h" // Para SettingsOptions, settings, VideoOptions, WindowOptions, video, window, AudioOptions, audio
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.hpp" // Para Name, name, Options, options, AttractMode #include "section.hpp" // Para Name, name, Options, options, AttractMode, attract_mode
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para boolToOnOff #include "utils.h" // Para boolToOnOff

View File

@@ -1,7 +1,6 @@
#include "input.h" #include "input.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_GetGamepa... #include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_GetGamepa...
#include <algorithm> // Para find #include <algorithm> // Para find
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <iterator> // Para distance #include <iterator> // Para distance

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_GamepadButton, Uint8, SDL_Gamepad, SDL_Joystick, SDL_JoystickID, SDL_Scancode, Sint16 #include <SDL3/SDL.h> // Para SDL_GamepadButton, Uint8, SDL_Gamepad, SDL_Joystick, SDL_JoystickID, SDL_Scancode, Sint16
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,10 +1,9 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, Uint16 #include <SDL3/SDL.h> // Para SDL_FRect, Uint16
#include <memory> // Para shared_ptr, unique_ptr
#include <memory> // Para shared_ptr, unique_ptr #include <string> // Para string
#include <string> // Para string #include <vector> // Para vector
#include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "utils.h" // Para Circle #include "utils.h" // Para Circle

View File

@@ -1,11 +1,10 @@
#include "manage_hiscore_table.h" #include "manage_hiscore_table.h"
#include <SDL3/SDL.h> // Para SDL_ReadIO, SDL_WriteIO, SDL_CloseIO, SDL_GetE... #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 <iterator> // Para distance
#include <algorithm> // Para find_if, sort #include "utils.h" // Para getFileName
#include <iterator> // Para distance
#include "utils.h" // Para getFileName
// Resetea la tabla a los valores por defecto // Resetea la tabla a los valores por defecto
void ManageHiScoreTable::clear() { void ManageHiScoreTable::clear() {

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_FPoint, SDL_FRect #include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_FPoint, SDL_FRect
#include <algorithm> // Para max #include <algorithm> // Para max
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr

View File

@@ -1,16 +1,15 @@
#include "options.h" #include "options.h"
#include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError #include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_ScaleMode, SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn
#include <algorithm> // Para clamp, max
#include <fstream> // Para basic_ostream, operator<<, basic_ostream::operator<<, basic_ofstream, basic_istream, basic_ifstream, ifstream, ofstream
#include <utility> // Para swap
#include <vector> // Para vector
#include <algorithm> // Para clamp #include "asset.h" // Para Asset
#include <fstream> // Para basic_ostream, operator<<, basic_ostream::... #include "input.h" // Para InputDevice
#include <utility> // Para swap #include "lang.h" // Para Code
#include <vector> // Para vector #include "utils.h" // Para boolToString, stringToBool, getFileName
#include "asset.h"
#include "input.h" // Para InputDeviceToUse
#include "lang.h" // Para Code
#include "utils.h" // Para boolToString, stringToBool, getFileName
namespace Options { namespace Options {
// --- Variables globales --- // --- Variables globales ---

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_ScaleMode #include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_ScaleMode
#include <algorithm> // Para copy #include <algorithm> // Para copy
#include <string> // Para allocator, string #include <string> // Para allocator, string
#include <utility> // Para move #include <utility> // Para move

View File

@@ -1,7 +1,6 @@
#include "param.h" #include "param.h"
#include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogError, SDL_LogInfo #include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogError, SDL_LogInfo
#include <fstream> // Para basic_istream, basic_ifstream, ifstream #include <fstream> // Para basic_istream, basic_ifstream, ifstream
#include <functional> #include <functional>
#include <sstream> // Para basic_istringstream #include <sstream> // Para basic_istringstream
@@ -9,7 +8,8 @@
#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 "utils.h" // Para Zone, Color, NotifyPosition, getFileName #include "color.h"
#include "utils.h"
Param param; Param param;

View File

@@ -1,11 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint32, SDL_FRect #include <SDL3/SDL.h> // Para Uint32, SDL_FRect
#include <array> // Para array #include <array> // Para array
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include "utils.h" // Para Color, NotifyPosition (ptr only), Zone #include "color.h" // Para Color, NotifyPosition (ptr only), Zone
#include "utils.h"
// --- Parámetros del juego --- // --- Parámetros del juego ---
struct ParamGame { struct ParamGame {

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FPoint #include <SDL3/SDL.h> // Para SDL_FPoint
#include <functional> // Para std::function #include <functional> // Para std::function
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,7 +1,6 @@
#include "player.h" #include "player.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_FlipMode, SDL_FRect #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_FlipMode, SDL_FRect
#include <algorithm> // Para clamp, max, min #include <algorithm> // Para clamp, max, min
#include <cstdlib> // Para rand #include <cstdlib> // Para rand

View File

@@ -1,10 +1,9 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint32, SDL_FRect #include <SDL3/SDL.h> // Para Uint32, SDL_FRect
#include <memory> // Para allocator, unique_ptr, shared_ptr
#include <memory> // Para unique_ptr, shared_ptr #include <string> // Para string
#include <string> // Para basic_string, string #include <vector> // Para vector
#include <vector> // Para vector
#include "animated_sprite.h" // Para AnimatedSprite #include "animated_sprite.h" // Para AnimatedSprite
#include "enter_name.h" // Para EnterName #include "enter_name.h" // Para EnterName

View File

@@ -1,19 +1,19 @@
#include "resource.h" #include "resource.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_L... #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 <algorithm> // Para find_if, max
#include <algorithm> // Para find_if #include <array> // Para array
#include <array> // Para array #include <cstdlib> // Para exit
#include <cstdlib> // Para exit #include <stdexcept> // Para runtime_error
#include <stdexcept> // Para runtime_error #include <utility> // Para move
#include <utility>
#include "asset.h" // Para Asset, AssetType #include "asset.h" // Para Asset, AssetType
#include "external/jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_... #include "color.h" // Para Color
#include "external/jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_LoadMusic, JA_LoadSound
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "param.h" // Para Param, param, ParamResource, ParamGame #include "param.h" // Para Param, param, ParamResource, ParamGame
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "text.h" // Para Text, loadTextFile, TextFile (ptr o... #include "text.h" // Para Text, loadTextFile, TextFile (ptr only)
struct JA_Music_t; // lines 11-11 struct JA_Music_t; // lines 11-11
struct JA_Sound_t; // lines 12-12 struct JA_Sound_t; // lines 12-12

View File

@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect #include <SDL3/SDL.h> // Para SDL_FRect
#include <cstddef> // Para size_t
#include <cstddef> // Para size_t #include <memory> // Para shared_ptr
#include <memory> // Para shared_ptr #include <string> // Para string
#include <string> // Para basic_string, string #include <utility> // Para move
#include <utility> #include <vector> // Para vector
#include <vector> // Para vector
#include "animated_sprite.h" // Para AnimationsFileBuffer #include "animated_sprite.h" // Para AnimationsFileBuffer
#include "text.h" // Para Text, TextFile #include "text.h" // Para Text, TextFile

View File

@@ -1,12 +1,12 @@
#include "scoreboard.h" #include "scoreboard.h"
#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
#include <algorithm> // Para max #include <algorithm> // Para max
#include <cmath> // Para roundf #include <cmath> // Para roundf
#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 "enter_name.h" // Para NAME_SIZE #include "enter_name.h" // Para NAME_SIZE
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "param.h" // Para Param, ParamScoreboard, param #include "param.h" // Para Param, ParamScoreboard, param

View File

@@ -1,14 +1,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FPoint, SDL_GetTicks, SDL_FRect, SDL_Texture, SDL_Renderer, Uint64 #include <SDL3/SDL.h> // Para SDL_FPoint, SDL_GetTicks, SDL_FRect, SDL_Texture, SDL_Renderer, Uint64
#include <array> // Para array
#include <cstddef> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string, basic_string
#include <vector> // Para vector
#include <array> #include "color.h" // Para Color
#include <cstddef> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para basic_string, string
#include <vector> // Para vector
#include "utils.h" // Para Color
class Sprite; class Sprite;
class Text; class Text;

View File

@@ -1,22 +1,22 @@
#include "screen.h" #include "screen.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_LogCategory #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 <algorithm> // Para min, max
#include <algorithm> // Para min, max #include <fstream> // Para basic_ifstream, ifstream
#include <fstream> // Para basic_ifstream, ifstream #include <iterator> // Para istreambuf_iterator, operator==
#include <iterator> // Para istreambuf_iterator, operator== #include <memory> // Para allocator, shared_ptr, make_shared, __shared_ptr_access
#include <memory> // Para allocator, shared_ptr, __shared_pt... #include <string> // Para operator+, char_traits, to_string, string
#include <string> // Para basic_string, char_traits, operator+
#include "asset.h" // Para Asset #include "asset.h" // Para Asset
#include "external/jail_shader.h" // Para init, render #include "external/jail_shader.h" // Para init, render
#include "mouse.h" // Para updateCursorVisibility #include "mouse.h" // Para updateCursorVisibility
#include "options.h" // Para VideoOptions, video, WindowOptions #include "options.h" // Para VideoOptions, video, WindowOptions, window
#include "param.h" // Para Param, param, ParamGame, ParamDebug #include "param.h" // Para Param, param, ParamGame, ParamDebug
#include "text.h" // Para Text, TEXT_COLOR, TEXT_STROKE #include "text.h" // Para Text, TEXT_COLOR, TEXT_STROKE
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Zone
// Singleton // Singleton
Screen *Screen::instance = nullptr; Screen *Screen::instance = nullptr;

View File

@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_HideWindow, SDL_Renderer, SDL_ShowWindow, Uint32, SDL_Texture, SDL_Window #include <SDL3/SDL.h> // Para SDL_FRect, SDL_HideWindow, SDL_Renderer, SDL_ShowWindow, Uint32, SDL_Texture, SDL_Window
#include <memory> // Para shared_ptr
#include <string> // Para string
#include <memory> // Para shared_ptr #include "color.h" // Para Color
#include <string> // Para basic_string, string #include "options.h" // Para VideoOptions, video
#include "options.h" // Para VideoOptions, video
#include "utils.h" // Para Color
class Notifier; class Notifier;
class ServiceMenu; class ServiceMenu;

View File

@@ -2,7 +2,6 @@
#include "credits.h" #include "credits.h"
#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
#include <algorithm> // Para max, min, clamp #include <algorithm> // Para max, min, clamp
#include <array> // Para array #include <array> // Para array
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
@@ -12,6 +11,7 @@
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.h" // Para BalloonManager
#include "color.h" // Para Zone, SHADOW_TEXT_COLOR, NO_TEXT_COLOR, Color
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
@@ -27,7 +27,7 @@
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Zone, SHADOW_TEXT_COLOR, NO_TEXT_COLOR, Color #include "utils.h"
// Textos // Textos
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner"; constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";

View File

@@ -1,13 +1,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, Uint32, SDL_Texture, Uint64 #include <SDL3/SDL.h> // Para SDL_FRect, Uint32, SDL_Texture, Uint64
#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 "options.h" // Para AudioOptions, MusicOptions, audio #include "options.h" // Para AudioOptions, MusicOptions, audio
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param
#include "utils.h" // Para Zone, Color #include "utils.h"
// Declaraciones adelantadas // Declaraciones adelantadas
class BalloonManager; class BalloonManager;

View File

@@ -1,12 +1,11 @@
#include "game.h" #include "game.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_EventType, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_Event, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
#include <algorithm> // Para max, find_if, clamp, find, min
#include <algorithm> // Para find_if, clamp, find, min #include <array> // Para array
#include <array> #include <cstdlib> // Para rand, size_t
#include <cstdlib> // Para rand, size_t #include <functional> // Para function
#include <functional> // Para function #include <iterator> // Para distance, size
#include <iterator> // Para distance, size
#include "asset.h" // Para Asset #include "asset.h" // Para Asset
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
@@ -14,22 +13,23 @@
#include "balloon.h" // Para Balloon, BALLOON_SPEED #include "balloon.h" // Para Balloon, BALLOON_SPEED
#include "balloon_manager.h" // Para BalloonManager #include "balloon_manager.h" // Para BalloonManager
#include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus #include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus
#include "color.h" // Para Color, FLASH_COLOR
#include "fade.h" // Para Fade, FadeType, FadeMode #include "fade.h" // Para Fade, FadeType, FadeMode
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
#include "input.h" // Para InputAction, Input, INPUT_DO_NOT_A... #include "input.h" // Para InputAction, Input, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_ALLOW_REPEAT, InputDevice
#include "item.h" // Para Item, ItemType #include "item.h" // Para Item, ItemType
#include "lang.h" // Para getText #include "lang.h" // Para getText
#include "manage_hiscore_table.h" // Para HiScoreEntry, ManageHiScoreTable #include "manage_hiscore_table.h" // Para ManageHiScoreTable, HiScoreEntry
#include "param.h" // Para Param, param, ParamGame, ParamScor... #include "param.h" // Para Param, param, ParamGame, ParamScoreboard, ParamFade, ParamBalloon
#include "path_sprite.h" // Para Path, PathSprite, createPath, Path... #include "path_sprite.h" // Para Path, PathSprite, createPath, PathType
#include "player.h" // Para Player, PlayerState #include "player.h" // Para Player, PlayerState
#include "resource.h" // Para Resource #include "resource.h" // Para Resource
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB... #include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREBOARD_LEFT_PANEL, SCOREBOARD_RIGHT_PANEL, SCOREBOARD_CENTER_PANEL
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "section.hpp" // Para Name, name, AttractMode, Options #include "section.hpp" // Para Name, name, AttractMode, Options, attract_mode, options
#include "smart_sprite.h" // Para SmartSprite #include "smart_sprite.h" // Para SmartSprite
#include "stage.h" // Para number, get, Stage, total_power #include "stage.h" // Para number, Stage, get, total_power, power, addPower, init, power_can_be_added, stages
#include "tabe.h" // Para Tabe, TabeState #include "tabe.h" // Para Tabe, TabeState
#include "text.h" // Para Text #include "text.h" // Para Text
#include "texture.h" // Para Texture #include "texture.h" // Para Texture

View File

@@ -1,13 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64, Uint8 #include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
#include <memory> // Para shared_ptr, unique_ptr #include "item.h" // Para Item, ItemType
#include <string> // Para string
#include <vector> // Para vector
#include "bullet.h" // Para Bullet, BulletType (ptr only)
#include "item.h" // Para Item, ItemType (ptr only)
#include "manage_hiscore_table.h" // Para HiScoreEntry #include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para SettingsOptions, settings, DifficultyCode (ptr only) #include "options.h" // Para SettingsOptions, settings, DifficultyCode (ptr only)
#include "path_sprite.h" // Para PathSprite, Path #include "path_sprite.h" // Para PathSprite, Path
@@ -18,12 +16,14 @@
class Background; class Background;
class Balloon; class Balloon;
class BalloonManager; class BalloonManager;
class Bullet;
class Fade; class Fade;
class Input; class Input;
class Scoreboard; class Scoreboard;
class Screen; class Screen;
class Tabe; class Tabe;
class Texture; class Texture;
enum class BulletType : Uint8;
// Modo demo // Modo demo
constexpr bool GAME_MODE_DEMO_OFF = false; constexpr bool GAME_MODE_DEMO_OFF = false;

View File

@@ -1,7 +1,6 @@
#include "hiscore_table.h" #include "hiscore_table.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget
#include <algorithm> // Para max #include <algorithm> // Para max
#include <cstdlib> // Para rand, size_t #include <cstdlib> // Para rand, size_t
#include <functional> // Para function #include <functional> // Para function
@@ -9,6 +8,7 @@
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "background.h" // Para Background #include "background.h" // Para Background
#include "color.h" // Para Color, easeOutQuint, NO_TEXT_COLOR
#include "fade.h" // Para Fade, FadeMode, FadeType #include "fade.h" // Para Fade, FadeMode, FadeType
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
@@ -24,7 +24,7 @@
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR #include "text.h" // Para Text, TEXT_SHADOW, TEXT_COLOR
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "utils.h" // Para Color, easeOutQuint, NO_TEXT_COLOR #include "utils.h"
// Constructor // Constructor
HiScoreTable::HiScoreTable() HiScoreTable::HiScoreTable()

View File

@@ -1,13 +1,12 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint16, SDL_FRect, SDL_Renderer, SDL_Texture, Uint64, Uint8 #include <SDL3/SDL.h> // Para Uint16, SDL_FRect, SDL_Renderer, SDL_Texture, Uint64, Uint8
#include <memory> // Para unique_ptr, shared_ptr
#include <memory> // Para unique_ptr, shared_ptr #include <string> // Para string
#include <string> // Para string #include <vector> // Para vector
#include <vector> // Para vector
#include "color.h" // Para Color
#include "path_sprite.h" // Para Path, PathSprite (ptr only) #include "path_sprite.h" // Para Path, PathSprite (ptr only)
#include "utils.h" // Para Color
class Background; class Background;
class Fade; class Fade;

View File

@@ -1,7 +1,6 @@
#include "instructions.h" #include "instructions.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_Re... #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_Re...
#include <algorithm> // Para max #include <algorithm> // Para max
#include <array> // Para array #include <array> // Para array
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
@@ -9,6 +8,7 @@
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "color.h" // Para Color, SHADOW_TEXT_COLOR, Zone, NO_TEXT_C...
#include "fade.h" // Para Fade, FadeMode, FadeType #include "fade.h" // Para Fade, FadeMode, FadeType
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
@@ -21,7 +21,7 @@
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR, TEXT_SHADOW #include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR, TEXT_SHADOW
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "utils.h" // Para Color, SHADOW_TEXT_COLOR, Zone, NO_TEXT_C... #include "utils.h"
// Constructor // Constructor
Instructions::Instructions() Instructions::Instructions()

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_Texture, Uint32, SDL_Renderer, SDL_FPoint, SDL_FRect, Uint64 #include <SDL3/SDL.h> // Para SDL_Texture, Uint32, SDL_Renderer, SDL_FPoint, SDL_FRect, Uint64
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector #include <vector> // Para vector

View File

@@ -1,7 +1,6 @@
#include "intro.h" #include "intro.h"
#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, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_Event, SDL_EventType, 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, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_Event, SDL_EventType, Uint32
#include <algorithm> // Para max #include <algorithm> // Para max
#include <array> // Para array #include <array> // Para array
#include <functional> // Para function #include <functional> // Para function
@@ -10,6 +9,7 @@
#include <utility> // Para move #include <utility> // Para move
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "color.h" // Para Color, Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
#include "input.h" // Para Input #include "input.h" // Para Input
@@ -22,8 +22,8 @@
#include "text.h" // Para Text #include "text.h" // Para Text
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "utils.h" // Para Color, Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint #include "utils.h"
#include "writer.h" // Para Writer #include "writer.h" // Para Writer
#ifdef DEBUG #ifdef DEBUG
#include <iomanip> // Para operator<<, setfill, setw #include <iomanip> // Para operator<<, setfill, setw
@@ -98,7 +98,7 @@ void Intro::updateScenes() {
void Intro::updateScene0() { void Intro::updateScene0() {
// Primera imagen - UPV // Primera imagen - UPV
enableCardAndShadow(0); enableCardAndShadow(0);
// Primer texto de la primera imagen // Primer texto de la primera imagen
if (card_sprites_.at(0)->hasFinished() && !texts_.at(0)->hasFinished()) { if (card_sprites_.at(0)->hasFinished() && !texts_.at(0)->hasFinished()) {
texts_.at(0)->setEnabled(true); texts_.at(0)->setEnabled(true);

View File

@@ -1,14 +1,14 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint32, Uint64 #include <SDL3/SDL.h> // Para SDL_Keycode, Uint32, Uint64
#include <stdint.h> // Para uint8_t
#include <memory> // Para unique_ptr #include <memory> // Para unique_ptr
#include <vector> // Para vector #include <vector> // Para vector
#include "color.h" // Para Color
#include "param.h" // Para Param, ParamIntro, param #include "param.h" // Para Param, ParamIntro, param
#include "path_sprite.h" // Para PathSprite #include "path_sprite.h" // Para PathSprite
#include "tiled_bg.h" // Para TiledBG #include "tiled_bg.h" // Para TiledBG
#include "utils.h" // Para Color
#include "writer.h" // Para Writer #include "writer.h" // Para Writer
/* /*

View File

@@ -1,11 +1,11 @@
#include "logo.h" #include "logo.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect #include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect
#include <algorithm> // Para max #include <algorithm> // Para max
#include <utility> // Para move #include <utility> // Para move
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "color.h" // Para Color, Zone
#include "global_events.h" // Para check #include "global_events.h" // Para check
#include "global_inputs.h" // Para check #include "global_inputs.h" // Para check
#include "input.h" // Para Input #include "input.h" // Para Input
@@ -15,7 +15,7 @@
#include "section.hpp" // Para Name, name #include "section.hpp" // Para Name, name
#include "sprite.h" // Para Sprite #include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture #include "texture.h" // Para Texture
#include "utils.h" // Para Color, Zone #include "utils.h"
// Constructor // Constructor
Logo::Logo() Logo::Logo()

View File

@@ -1,12 +1,11 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FPoint, Uint64 #include <SDL3/SDL.h> // Para SDL_FPoint, Uint64
#include <memory> // Para unique_ptr, shared_ptr
#include <vector> // Para vector
#include <memory> // Para unique_ptr, shared_ptr #include "color.h" // Para Color
#include <vector> // Para vector #include "sprite.h" // Para Sprite
#include "sprite.h" // Para Sprite
#include "utils.h" // Para Color
class Texture; class Texture;

View File

@@ -1,7 +1,6 @@
#include "title.h" #include "title.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_EventType #include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_EventType
#include <algorithm> // Para find_if #include <algorithm> // Para find_if
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <iostream> // Para basic_ostream, basic_ostream::operator<< #include <iostream> // Para basic_ostream, basic_ostream::operator<<
@@ -9,6 +8,7 @@
#include <vector> // Para vector #include <vector> // Para vector
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "color.h" // Para Color, Zone, NO_TEXT_COLOR, TITLE_SHADO...
#include "define_buttons.h" // Para DefineButtons #include "define_buttons.h" // Para DefineButtons
#include "fade.h" // Para Fade, FadeType #include "fade.h" // Para Fade, FadeType
#include "game_logo.h" // Para GameLogo #include "game_logo.h" // Para GameLogo
@@ -27,7 +27,7 @@
#include "tiled_bg.h" // Para TiledBG, TiledBGMode #include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "ui/notifier.h" // Para Notifier #include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Color, Zone, NO_TEXT_COLOR, TITLE_SHADO... #include "utils.h"
class Texture; class Texture;

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint32 #include <SDL3/SDL.h> // Para Uint32
#include <memory> // Para unique_ptr, shared_ptr #include <memory> // Para unique_ptr, shared_ptr
#include <string_view> #include <string_view>
#include <vector> #include <vector>

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_FPoint #include <SDL3/SDL.h> // Para SDL_FRect, SDL_FPoint
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
class Texture; class Texture;

View File

@@ -2,10 +2,9 @@
#include "tabe.h" #include "tabe.h"
#include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_GetTicks #include <SDL3/SDL.h> // Para SDL_FlipMode, SDL_GetTicks
#include <algorithm> // Para max
#include <algorithm> // Para max #include <array> // Para array
#include <array> // Para array #include <cstdlib> // Para rand, abs
#include <cstdlib> // Para rand, abs
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "param.h" // Para Param, ParamGame, param #include "param.h" // Para Param, ParamGame, param

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint32, SDL_GetTicks, SDL_FRect #include <SDL3/SDL.h> // Para Uint32, SDL_GetTicks, SDL_FRect
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include <memory> // Para unique_ptr #include <memory> // Para unique_ptr

View File

@@ -1,7 +1,6 @@
#include "text.h" #include "text.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_GetRenderTarget, Uint8 #include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_GetRenderTarget, Uint8
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <fstream> // Para basic_ifstream, basic_istream, basic_ostream #include <fstream> // Para basic_ifstream, basic_istream, basic_ostream
#include <iostream> // Para cerr #include <iostream> // Para cerr

View File

@@ -1,14 +1,12 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8 #include <SDL3/SDL.h> // Para Uint8
#include <array> // Para array
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <array> #include "color.h" // Para Color
#include <memory> // Para unique_ptr, shared_ptr #include "sprite.h" // Para Sprite
#include <string> // Para string
#include "color.h" // Para Color
#include "sprite.h" // Para Sprite
#include "utils.h"
class Texture; class Texture;

View File

@@ -2,7 +2,6 @@
#include "texture.h" #include "texture.h"
#include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, Uint8, SDL_... #include <SDL3/SDL.h> // Para SDL_LogError, SDL_LogCategory, Uint8, SDL_...
#include <cstdint> // Para uint32_t #include <cstdint> // Para uint32_t
#include <cstring> // Para memcpy #include <cstring> // Para memcpy
#include <fstream> // Para basic_ifstream, basic_istream, basic_ios #include <fstream> // Para basic_ifstream, basic_istream, basic_ios
@@ -12,9 +11,10 @@
#include <utility> #include <utility>
#include <vector> // Para vector #include <vector> // Para vector
#include "color.h" // Para getFileName, Color, printWithDots
#include "external/gif.h" // Para Gif #include "external/gif.h" // Para Gif
#include "stb_image.h" // Para stbi_image_free, stbi_load, STBI_rgb_alpha #include "stb_image.h" // Para stbi_image_free, stbi_load, STBI_rgb_alpha
#include "utils.h" // Para getFileName, Color, printWithDots #include "utils.h"
// Constructor // Constructor
Texture::Texture(SDL_Renderer *renderer, std::string path) Texture::Texture(SDL_Renderer *renderer, std::string path)

View File

@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8, SDL_Renderer, Uint16, SDL_FlipMode, SDL_PixelFormat, SDL_TextureAccess, SDL_Texture, Uint32, SDL_BlendMode, SDL_FPoint, SDL_FRect #include <SDL3/SDL.h> // Para Uint8, SDL_Renderer, Uint16, SDL_FlipMode, SDL_PixelFormat, SDL_TextureAccess, SDL_Texture, Uint32, SDL_BlendMode, SDL_FPoint, SDL_FRect
#include <array> // Para array #include <array> // Para array
#include <cstddef> // Para size_t #include <cstddef> // Para size_t
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr

View File

@@ -1,7 +1,6 @@
#include "tiled_bg.h" #include "tiled_bg.h"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_FRect, SDL_GetRenderTarget, SDL_RenderTexture, SDL_PixelFormat, SDL_TextureAccess #include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_CreateTexture, SDL_DestroyTexture, SDL_FRect, SDL_GetRenderTarget, SDL_RenderTexture, SDL_PixelFormat, SDL_TextureAccess
#include <cmath> // Para sin #include <cmath> // Para sin
#include <cstdlib> // Para rand #include <cstdlib> // Para rand
#include <memory> // Para allocator, unique_ptr, make_unique #include <memory> // Para allocator, unique_ptr, make_unique

View File

@@ -1,10 +1,9 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetTextureColorMod, SDL_Renderer, SDL_Texture #include <SDL3/SDL.h> // Para SDL_FRect, SDL_SetTextureColorMod, SDL_Renderer, SDL_Texture
#include <array> // Para array
#include <array> #include "color.h" // Para Color
#include "utils.h" // Para Color
// Modos de funcionamiento para el tileado de fondo // Modos de funcionamiento para el tileado de fondo
enum class TiledBGMode : int { enum class TiledBGMode : int {

View File

@@ -1,12 +1,14 @@
#include "menu_renderer.h" #include "menu_renderer.h"
#include <algorithm> // Para max #include <algorithm> // Para max
#include <utility> // Para pair, move #include <utility> // Para pair, move
#include "color.h" // Para Color, generateMirroredCycle, ColorCycleStyle
#include "menu_option.h" // Para MenuOption #include "menu_option.h" // Para MenuOption
#include "param.h" // Para Param, param, ParamServiceMenu, ParamGame #include "param.h" // Para Param, param, ParamServiceMenu, ParamGame
#include "screen.h" // Para Screen #include "screen.h" // Para Screen
#include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR #include "text.h" // Para Text, TEXT_CENTER, TEXT_COLOR
#include "utils.h" // Para Zone
MenuRenderer::MenuRenderer(const ServiceMenu *menu_state, std::shared_ptr<Text> element_text, std::shared_ptr<Text> title_text) MenuRenderer::MenuRenderer(const ServiceMenu *menu_state, std::shared_ptr<Text> element_text, std::shared_ptr<Text> title_text)
: element_text_(std::move(element_text)), title_text_(std::move(title_text)) {} : element_text_(std::move(element_text)), title_text_(std::move(title_text)) {}

View File

@@ -1,14 +1,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, Uint32 #include <SDL3/SDL.h> // Para SDL_FRect, Uint32
#include <array> // Para array
#include <array> #include <cstddef> // Para size_t
#include <cstddef> // Para size_t #include <memory> // Para shared_ptr, unique_ptr
#include <memory> // Para shared_ptr, unique_ptr #include <vector> // Para vector
#include <vector> // Para vector
#include "color.h" // Para Color
#include "ui/service_menu.h" // Para ServiceMenu #include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Color
class MenuOption; class MenuOption;
// Forward declarations // Forward declarations

View File

@@ -1,7 +1,6 @@
#include "notifier.h" #include "notifier.h"
#include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_FRect, SDL_RenderClear #include <SDL3/SDL.h> // Para SDL_RenderFillRect, SDL_FRect, SDL_RenderClear
#include <algorithm> // Para remove_if #include <algorithm> // Para remove_if
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include <utility> #include <utility>

View File

@@ -1,12 +1,12 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para SDL_FRect, SDL_Renderer #include <SDL3/SDL.h> // Para SDL_FRect, SDL_Renderer
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para basic_string, string #include <string> // Para basic_string, string
#include <vector> // Para vector #include <vector> // Para vector
#include "utils.h" // Para stringInVector, Color #include "color.h" // Para stringInVector, Color
#include "utils.h"
class Sprite; class Sprite;
class Text; class Text;

View File

@@ -1,6 +1,6 @@
#include "ui/service_menu.h" #include "ui/service_menu.h"
#include <algorithm> // Para max #include <algorithm> // Para max
#include "audio.h" // Para Audio #include "audio.h" // Para Audio
#include "lang.h" // Para getText, getCodeFromName, getNameFromCode #include "lang.h" // Para getText, getCodeFromName, getNameFromCode

View File

@@ -1,9 +1,9 @@
#pragma once #pragma once
#include <memory> // Para shared_ptr #include <memory> // Para shared_ptr
#include <string> // Para string, basic_string #include <string> // Para string
#include "utils.h" // Para Color #include "color.h" // Para Color
class Text; class Text;

View File

@@ -1,36 +1,21 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include "utils.h" #include "utils.h"
#include <SDL3/SDL.h> // Para SDL_RenderPoint, SDL_FRect, SDL_CloseIO, SDL_I... #include <SDL3/SDL.h> // Para SDL_RenderPoint, SDL_FRect, SDL_CloseIO, SDL_IOFromFile, SDL_LogCategory, SDL_LogError, SDL_LogInfo, SDL_ReadIO, SDL_FPoint, SDL_Renderer
#include <algorithm> // Para clamp, find_if_not, find, transform
#include <algorithm> // Para min, clamp, find_if_not, find, transform
#include <cctype> // Para tolower, isspace #include <cctype> // Para tolower, isspace
#include <cmath> // Para pow, sinf, fmaxf, fminf, M_PI, fmodf, roundf, sin #include <cmath> // Para pow, sin, M_PI, cos
#include <compare> // Para operator< #include <compare> // Para operator<, __synth3way_t
#include <cstdlib> // Para size_t
#include <filesystem> // Para path #include <filesystem> // Para path
#include <stdexcept> // Para runtime_error #include <stdexcept> // Para runtime_error
#include <string> // Para basic_string, allocator, string, char_traits #include <string> // Para basic_string, allocator, string, operator==, operator+, char_traits
#include "lang.h" // Para getText #include "lang.h" // Para getText
// Variables // Variables
Overrides overrides = Overrides(); Overrides overrides = Overrides();
// Obtiene un color del vector de colores imitando al Coche Fantástico
auto getColorLikeKnightRider(const std::vector<Color> &colors, int counter) -> Color {
int cycle_length = colors.size() * 2 - 2;
size_t n = counter % cycle_length;
size_t index;
if (n < colors.size()) {
index = n; // Avanza: 0,1,2,3
} else {
index = 2 * (colors.size() - 1) - n; // Retrocede: 2,1
}
return colors[index];
}
// Calcula el cuadrado de la distancia entre dos puntos // Calcula el cuadrado de la distancia entre dos puntos
auto distanceSquared(int x1, int y1, int x2, int y2) -> double { auto distanceSquared(int x1, int y1, int x2, int y2) -> double {
const int DELTA_X = x2 - x1; const int DELTA_X = x2 - x1;
@@ -153,24 +138,6 @@ void drawCircle(SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int3
} }
} }
// Aclara el color
auto lightenColor(const Color &color, int amount) -> Color {
Color new_color;
new_color.r = std::min(255, color.r + amount);
new_color.g = std::min(255, color.g + amount);
new_color.b = std::min(255, color.b + amount);
return new_color;
}
// Oscurece el color
auto darkenColor(const Color &color, int amount) -> Color {
Color new_color;
new_color.r = std::min(255, color.r - +amount);
new_color.g = std::min(255, color.g - +amount);
new_color.b = std::min(255, color.b - +amount);
return new_color;
}
// Quita los espacioes en un string // Quita los espacioes en un string
auto trim(const std::string &str) -> std::string { auto trim(const std::string &str) -> std::string {
auto start = std::find_if_not(str.begin(), str.end(), ::isspace); auto start = std::find_if_not(str.begin(), str.end(), ::isspace);
@@ -369,128 +336,4 @@ auto getFileName(const std::string &path) -> std::string {
auto getPath(const std::string &full_path) -> std::string { auto getPath(const std::string &full_path) -> std::string {
std::filesystem::path path(full_path); std::filesystem::path path(full_path);
return path.parent_path().string(); return path.parent_path().string();
} }
constexpr auto rgbToHsv(Color color) -> HSV {
float r = color.r / 255.0F;
float g = color.g / 255.0F;
float b = color.b / 255.0F;
float max = fmaxf(fmaxf(r, g), b);
float min = fminf(fminf(r, g), b);
float delta = max - min;
float h = 0.0F;
if (delta > 0.00001F) {
if (max == r) {
h = fmodf((g - b) / delta, 6.0F);
} else if (max == g) {
h = ((b - r) / delta) + 2.0F;
} else {
h = ((r - g) / delta) + 4.0F;
}
h *= 60.0F;
if (h < 0.0F) {
h += 360.0F;
}
}
float s = (max <= 0.0F) ? 0.0F : delta / max;
float v = max;
return {h, s, v};
}
constexpr auto hsvToRgb(HSV hsv) -> Color {
float c = hsv.v * hsv.s;
float x = c * (1 - std::abs(std::fmod(hsv.h / 60.0F, 2) - 1));
float m = hsv.v - c;
float r = 0;
float g = 0;
float b = 0;
if (hsv.h < 60) {
r = c;
g = x;
b = 0;
} else if (hsv.h < 120) {
r = x;
g = c;
b = 0;
} else if (hsv.h < 180) {
r = 0;
g = c;
b = x;
} else if (hsv.h < 240) {
r = 0;
g = x;
b = c;
} else if (hsv.h < 300) {
r = x;
g = 0;
b = c;
} else {
r = c;
g = 0;
b = x;
}
return Color(
static_cast<uint8_t>(roundf((r + m) * 255)),
static_cast<uint8_t>(roundf((g + m) * 255)),
static_cast<uint8_t>(roundf((b + m) * 255)));
}
auto generateMirroredCycle(Color base, ColorCycleStyle style) -> ColorCycle {
ColorCycle result{};
HSV base_hsv = rgbToHsv(base);
for (size_t i = 0; i < COLOR_CYCLE_SIZE; ++i) {
float t = static_cast<float>(i) / (COLOR_CYCLE_SIZE - 1); // 0 → 1
float hue_shift = 0.0F;
float sat_shift = 0.0F;
float val_shift = 0.0F;
switch (style) {
case ColorCycleStyle::SUBTLE_PULSE:
// Solo brillo suave
val_shift = 0.07F * sinf(t * M_PI);
break;
case ColorCycleStyle::HUE_WAVE:
// Oscilación leve de tono
hue_shift = 15.0F * (t - 0.5F) * 2.0F;
val_shift = 0.05F * sinf(t * M_PI);
break;
case ColorCycleStyle::VIBRANT:
// Cambios fuertes en tono y brillo
hue_shift = 35.0F * sinf(t * M_PI);
val_shift = 0.2F * sinf(t * M_PI);
sat_shift = -0.2F * sinf(t * M_PI);
break;
case ColorCycleStyle::DARKEN_GLOW:
// Se oscurece al centro
val_shift = -0.15F * sinf(t * M_PI);
break;
case ColorCycleStyle::LIGHT_FLASH:
// Se ilumina al centro
val_shift = 0.25F * sinf(t * M_PI);
break;
}
HSV adjusted = {
fmodf(base_hsv.h + hue_shift + 360.0F, 360.0F),
fminf(1.0F, fmaxf(0.0F, base_hsv.s + sat_shift)),
fminf(1.0F, fmaxf(0.0F, base_hsv.v + val_shift))};
Color c = hsvToRgb(adjusted);
result[i] = c;
result[2 * COLOR_CYCLE_SIZE - 1 - i] = c; // espejo
}
return result;
}

View File

@@ -2,20 +2,13 @@
#pragma once #pragma once
#include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_FPoint, SDL_Renderer #include <SDL3/SDL.h> // Para Uint8, SDL_FRect, SDL_FPoint, SDL_Renderer
#include <cstdint> // Para int32_t
#include <algorithm> // Para max, min #include <string> // Para string
#include <array> // Para array #include <vector> // Para vector
#include <cctype> // Para isxdigit
#include <cstdint> // Para int32_t
#include <cstdlib> // Para size_t, abs
#include <stdexcept> // Para invalid_argument
#include <string> // Para string, basic_string, stoi
#include <vector> // Para vector
// --- Constantes --- // --- Constantes ---
constexpr int BLOCK = 8; constexpr int BLOCK = 8;
constexpr int TOTAL_DEMO_DATA = 2000; constexpr int TOTAL_DEMO_DATA = 2000;
constexpr size_t COLOR_CYCLE_SIZE = 6; // Mitad del ciclo espejado
// --- Estructuras y tipos --- // --- Estructuras y tipos ---
struct Overrides { struct Overrides {
@@ -34,118 +27,6 @@ struct Circle {
: x(x_coord), y(y_coord), r(radius) {} : x(x_coord), y(y_coord), r(radius) {}
}; };
// Estructura para definir un color RGBA
struct Color {
private:
static constexpr Uint8 MAX_COLOR_VALUE = 255;
static constexpr Uint8 MIN_COLOR_VALUE = 0;
static constexpr Uint8 DEFAULT_ALPHA = 255;
static constexpr int DEFAULT_LIGHTEN_AMOUNT = 50;
static constexpr int DEFAULT_DARKEN_AMOUNT = 50;
static constexpr int DEFAULT_APPROACH_STEP = 1;
static constexpr size_t HEX_RGB_LENGTH = 6;
static constexpr size_t HEX_RGBA_LENGTH = 8;
static constexpr int HEX_BASE = 16;
static constexpr size_t HEX_COMPONENT_LENGTH = 2;
public:
Uint8 r, g, b, a;
constexpr Color() : r(MIN_COLOR_VALUE), g(MIN_COLOR_VALUE), b(MIN_COLOR_VALUE), a(DEFAULT_ALPHA) {}
explicit constexpr Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = DEFAULT_ALPHA)
: r(red), g(green), b(blue), a(alpha) {}
[[nodiscard]] constexpr auto INVERSE() const -> Color {
return Color(MAX_COLOR_VALUE - r, MAX_COLOR_VALUE - g, MAX_COLOR_VALUE - b, a);
}
[[nodiscard]] constexpr auto LIGHTEN(int amount = DEFAULT_LIGHTEN_AMOUNT) const -> Color {
return Color(
std::min(static_cast<int>(MAX_COLOR_VALUE), r + amount),
std::min(static_cast<int>(MAX_COLOR_VALUE), g + amount),
std::min(static_cast<int>(MAX_COLOR_VALUE), b + amount),
a);
}
[[nodiscard]] constexpr auto DARKEN(int amount = DEFAULT_DARKEN_AMOUNT) const -> Color {
return Color(
std::max(static_cast<int>(MIN_COLOR_VALUE), r - amount),
std::max(static_cast<int>(MIN_COLOR_VALUE), g - amount),
std::max(static_cast<int>(MIN_COLOR_VALUE), b - amount),
a);
}
// Método estático para crear Color desde string hexadecimal
static auto fromHex(const std::string &hex_str) -> Color {
std::string hex = hex_str;
// Quitar '#' si existe
if (!hex.empty() && hex[0] == '#') {
hex = hex.substr(1);
}
// Verificar longitud válida (6 para RGB o 8 para RGBA)
if (hex.length() != HEX_RGB_LENGTH && hex.length() != HEX_RGBA_LENGTH) {
throw std::invalid_argument("String hexadecimal debe tener 6 o 8 caracteres");
}
// Verificar que todos los caracteres sean hexadecimales válidos
for (char c : hex) {
if (std::isxdigit(c) == 0) {
throw std::invalid_argument("String contiene caracteres no hexadecimales");
}
}
// Convertir cada par de caracteres a valores RGB(A)
Uint8 r = static_cast<Uint8>(std::stoi(hex.substr(0, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 g = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 b = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH * 2, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
Uint8 a = DEFAULT_ALPHA; // Alpha por defecto
// Si tiene 8 caracteres, extraer el alpha
if (hex.length() == HEX_RGBA_LENGTH) {
a = static_cast<Uint8>(std::stoi(hex.substr(HEX_COMPONENT_LENGTH * 3, HEX_COMPONENT_LENGTH), nullptr, HEX_BASE));
}
return Color(r, g, b, a);
}
[[nodiscard]] constexpr auto IS_EQUAL_TO(const Color &other) const -> bool {
return r == other.r && g == other.g && b == other.b && a == other.a;
}
[[nodiscard]] constexpr auto APPROACH_TO(const Color &target, int step = DEFAULT_APPROACH_STEP) const -> Color {
auto approach_component = [step](Uint8 current, Uint8 target_val) -> Uint8 {
if (std::abs(current - target_val) <= step) {
return target_val;
}
return (current < target_val) ? current + step : current - step;
};
Uint8 new_r = approach_component(r, target.r);
Uint8 new_g = approach_component(g, target.g);
Uint8 new_b = approach_component(b, target.b);
Uint8 new_a = approach_component(a, target.a);
return Color(new_r, new_g, new_b, new_a);
}
};
// Estructura para definir un color HSV
struct HSV {
float h, s, v;
};
// Estructura para definir el ciclo de color
enum class ColorCycleStyle {
SUBTLE_PULSE, // Variación leve en brillo (por defecto)
HUE_WAVE, // Variación suave en tono (sin verde)
VIBRANT, // Cambios agresivos en tono y brillo
DARKEN_GLOW, // Oscurece hacia el centro y regresa
LIGHT_FLASH // Ilumina hacia el centro y regresa
};
// Posiciones de las notificaciones // Posiciones de las notificaciones
enum class NotifyPosition { enum class NotifyPosition {
TOP, TOP,
@@ -193,28 +74,8 @@ struct Zone {
float third_quarter_y; // Anclaje al 75% del eje Y float third_quarter_y; // Anclaje al 75% del eje Y
}; };
// --- Alias ---
using ColorCycle = std::array<Color, 2 * COLOR_CYCLE_SIZE>;
// --- Funciones utilitarias --- // --- Funciones utilitarias ---
// Colores
constexpr Color NO_TEXT_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color SHADOW_TEXT_COLOR = Color(0X43, 0X43, 0X4F);
constexpr Color TITLE_SHADOW_TEXT_COLOR = Color(0x14, 0x87, 0xc4);
constexpr Color FLASH_COLOR = Color(0XFF, 0XFF, 0XFF);
constexpr Color BLUE_SKY_COLOR = Color(0X02, 0X88, 0XD1);
constexpr Color PINK_SKY_COLOR = Color(0XFF, 0X6B, 0X97);
constexpr Color GREEN_SKY_COLOR = Color(0X00, 0X79, 0X6B);
// Colores y gráficos
auto getColorLikeKnightRider(const std::vector<Color> &colors, int counter) -> Color;
constexpr auto rgbToHsv(Color color) -> HSV;
constexpr auto hsvToRgb(HSV hsv) -> Color;
auto generateMirroredCycle(Color base, ColorCycleStyle style = ColorCycleStyle::SUBTLE_PULSE) -> ColorCycle;
// Colisiones y geometría // Colisiones y geometría
auto distanceSquared(int x1, int y1, int x2, int y2) -> double; auto distanceSquared(int x1, int y1, int x2, int y2) -> double;
auto checkCollision(const Circle &a, const Circle &b) -> bool; auto checkCollision(const Circle &a, const Circle &b) -> bool;
@@ -232,10 +93,6 @@ auto trim(const std::string &str) -> std::string;
// Dibujo // Dibujo
void drawCircle(SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int32_t radius); void drawCircle(SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int32_t radius);
// Manipulación de color
auto lightenColor(const Color &color, int amount) -> Color;
auto darkenColor(const Color &color, int amount) -> Color;
// Funciones de suavizado (easing) // Funciones de suavizado (easing)
auto easeOutQuint(double time) -> double; auto easeOutQuint(double time) -> double;
auto easeInQuint(double time) -> double; auto easeInQuint(double time) -> double;