iwyu
clang-format
This commit is contained in:
@@ -2,5 +2,7 @@
|
|||||||
clang-tidy source/fitxer.cpp -p build/ --fix
|
clang-tidy source/fitxer.cpp -p build/ --fix
|
||||||
|
|
||||||
# Per a varios fitxers, desde l'arrel:
|
# Per a varios fitxers, desde l'arrel:
|
||||||
find source/ \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) | xargs -P4 -I{} clang-tidy {} -p build/ --fix
|
find source/ \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) | \
|
||||||
|
xargs -P4 -I{} bash -c 'echo "Procesando: {}"; clang-tidy {} -p build/ --fix'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "animated_sprite.h"
|
#include "animated_sprite.h"
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
#include <algorithm> // Para min, max
|
#include <algorithm> // Para min, max
|
||||||
#include <cstddef> // Para size_t
|
#include <cstddef> // Para size_t
|
||||||
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios, ifstream, stringstream
|
#include <fstream> // Para basic_istream, basic_ifstream, basic_ios, ifstream, stringstream
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 <array> // Para array
|
||||||
#include <cstddef> // Para size_t
|
#include <cstddef> // Para size_t
|
||||||
#include <memory> // Para unique_ptr, shared_ptr
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
|
|||||||
@@ -171,13 +171,13 @@ void Balloon::handleVerticalMovement() {
|
|||||||
handleBottomCollision();
|
handleBottomCollision();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Balloon::isOutOfHorizontalBounds(float minX, float maxX) const {
|
auto Balloon::isOutOfHorizontalBounds(float min_x, float max_x) const -> bool {
|
||||||
return x_ < minX || x_ > maxX;
|
return x_ < min_x || x_ > max_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Balloon::handleHorizontalBounce(float minX, float maxX) {
|
void Balloon::handleHorizontalBounce(float min_x, float max_x) {
|
||||||
playBouncingSound();
|
playBouncingSound();
|
||||||
x_ = std::clamp(x_, minX, maxX);
|
x_ = std::clamp(x_, min_x, max_x);
|
||||||
vx_ = -vx_;
|
vx_ = -vx_;
|
||||||
|
|
||||||
if (type_ == BalloonType::POWERBALL) {
|
if (type_ == BalloonType::POWERBALL) {
|
||||||
@@ -187,7 +187,7 @@ void Balloon::handleHorizontalBounce(float minX, float maxX) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Balloon::shouldCheckTopCollision() const {
|
auto Balloon::shouldCheckTopCollision() const -> bool {
|
||||||
// Colisión en la parte superior solo si el globo va de subida
|
// Colisión en la parte superior solo si el globo va de subida
|
||||||
return vy_ < 0;
|
return vy_ < 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,11 +187,11 @@ class Balloon {
|
|||||||
void enableBounceEffect(); // Activa el efecto de rebote
|
void enableBounceEffect(); // Activa el efecto de rebote
|
||||||
void disableBounceEffect(); // Detiene el efecto de rebote
|
void disableBounceEffect(); // Detiene el efecto de rebote
|
||||||
void updateBounceEffect(); // Actualiza el estado del rebote
|
void updateBounceEffect(); // Actualiza el estado del rebote
|
||||||
void handleHorizontalBounce(float minX, float maxX); // Maneja el rebote horizontal dentro de límites
|
void handleHorizontalBounce(float min_x, float max_x); // Maneja el rebote horizontal dentro de límites
|
||||||
|
|
||||||
// --- Colisiones ---
|
// --- Colisiones ---
|
||||||
bool isOutOfHorizontalBounds(float minX, float maxX) const; // Verifica si está fuera de los límites horizontales
|
[[nodiscard]] auto isOutOfHorizontalBounds(float min_x, float max_x) const -> bool; // Verifica si está fuera de los límites horizontales
|
||||||
bool shouldCheckTopCollision() const; // Determina si debe comprobarse la colisión superior
|
[[nodiscard]] auto shouldCheckTopCollision() const -> bool; // Determina si debe comprobarse la colisión superior
|
||||||
void handleTopCollision(); // Maneja la colisión superior
|
void handleTopCollision(); // Maneja la colisión superior
|
||||||
void handleBottomCollision(); // Maneja la colisión inferior
|
void handleBottomCollision(); // Maneja la colisión inferior
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
||||||
#include <algorithm> // Para min, clamp
|
#include <stdint.h> // Para uint8_t
|
||||||
#include <cmath> // Para fmaxf, fminf, M_PI, fmodf, roundf, sin, abs
|
|
||||||
|
#include <cctype> // Para isxdigit
|
||||||
|
#include <cmath> // Para sinf, fmaxf, fminf, M_PI, fmodf, roundf, fmod
|
||||||
#include <stdexcept> // Para invalid_argument
|
#include <stdexcept> // Para invalid_argument
|
||||||
#include <string> // Para basic_string, string
|
#include <string> // Para basic_string, stoi, string
|
||||||
|
|
||||||
// Método estático para crear Color desde string hexadecimal
|
// Método estático para crear Color desde string hexadecimal
|
||||||
auto Color::fromHex(const std::string &hex_str) -> Color {
|
auto Color::fromHex(const std::string &hex_str) -> Color {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para Uint8
|
#include <SDL3/SDL.h> // Para Uint8
|
||||||
|
#include <bits/std_abs.h> // Para abs
|
||||||
|
|
||||||
#include <algorithm> // Para max, min
|
#include <algorithm> // Para max, min
|
||||||
#include <array> // Para array
|
#include <array> // Para array
|
||||||
#include <cctype> // Para isxdigit
|
#include <cstdlib> // Para size_t, abs
|
||||||
#include <cstdlib> // Para abs
|
#include <string> // Para string
|
||||||
#include <stdexcept> // Para invalid_argument
|
|
||||||
#include <string> // Para string, basic_string, stoi
|
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
// --- Constantes ---
|
// --- Constantes ---
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ void init() {
|
|||||||
difficulties_list = {
|
difficulties_list = {
|
||||||
{Code::EASY, "Easy"},
|
{Code::EASY, "Easy"},
|
||||||
{Code::NORMAL, "Normal"},
|
{Code::NORMAL, "Normal"},
|
||||||
{Code::HARD, "Hard"}
|
{Code::HARD, "Hard"}};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getDifficulties() -> std::vector<Info>& {
|
auto getDifficulties() -> std::vector<Info>& {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
@@ -192,10 +193,10 @@ void GameLogo::processShakeEffect(SmartSprite* primary_sprite, SmartSprite* seco
|
|||||||
shake_.counter--;
|
shake_.counter--;
|
||||||
} else {
|
} else {
|
||||||
shake_.counter = shake_.delay;
|
shake_.counter = shake_.delay;
|
||||||
const auto displacement = calculateShakeDisplacement();
|
const auto DISPLACEMENT = calculateShakeDisplacement();
|
||||||
primary_sprite->setPosX(shake_.origin + displacement);
|
primary_sprite->setPosX(shake_.origin + DISPLACEMENT);
|
||||||
if (secondary_sprite) {
|
if (secondary_sprite != nullptr) {
|
||||||
secondary_sprite->setPosX(shake_.origin + displacement + 15);
|
secondary_sprite->setPosX(shake_.origin + DISPLACEMENT + 15);
|
||||||
}
|
}
|
||||||
shake_.remaining--;
|
shake_.remaining--;
|
||||||
}
|
}
|
||||||
@@ -206,13 +207,13 @@ void GameLogo::processArcadeEditionShake() {
|
|||||||
shake_.counter--;
|
shake_.counter--;
|
||||||
} else {
|
} else {
|
||||||
shake_.counter = shake_.delay;
|
shake_.counter = shake_.delay;
|
||||||
const auto displacement = calculateShakeDisplacement();
|
const auto DISPLACEMENT = calculateShakeDisplacement();
|
||||||
arcade_edition_sprite_->setX(shake_.origin + displacement);
|
arcade_edition_sprite_->setX(shake_.origin + DISPLACEMENT);
|
||||||
shake_.remaining--;
|
shake_.remaining--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GameLogo::calculateShakeDisplacement() const {
|
auto GameLogo::calculateShakeDisplacement() const -> int {
|
||||||
return shake_.remaining % 2 == 0 ? shake_.desp * (-1) : shake_.desp;
|
return shake_.remaining % 2 == 0 ? shake_.desp * (-1) : shake_.desp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class GameLogo {
|
|||||||
void handleArcadeEditionShaking(); // Maneja la sacudida de "Arcade Edition"
|
void handleArcadeEditionShaking(); // Maneja la sacudida de "Arcade Edition"
|
||||||
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite = nullptr); // Procesa el efecto de sacudida en sprites
|
void processShakeEffect(SmartSprite* primary_sprite, SmartSprite* secondary_sprite = nullptr); // Procesa el efecto de sacudida en sprites
|
||||||
void processArcadeEditionShake(); // Procesa la sacudida específica de "Arcade Edition"
|
void processArcadeEditionShake(); // Procesa la sacudida específica de "Arcade Edition"
|
||||||
int calculateShakeDisplacement() const; // Calcula el desplazamiento de la sacudida
|
[[nodiscard]] auto calculateShakeDisplacement() const -> int; // Calcula el desplazamiento de la sacudida
|
||||||
|
|
||||||
// --- Gestión de finalización de efectos ---
|
// --- Gestión de finalización de efectos ---
|
||||||
void handleCoffeeCrisisFinished(); // Maneja el final de la animación "Coffee Crisis"
|
void handleCoffeeCrisisFinished(); // Maneja el final de la animación "Coffee Crisis"
|
||||||
@@ -100,6 +100,6 @@ class GameLogo {
|
|||||||
void finishArcadeEditionMoving(); // Finaliza el movimiento de "Arcade Edition"
|
void finishArcadeEditionMoving(); // Finaliza el movimiento de "Arcade Edition"
|
||||||
|
|
||||||
// --- Utilidades ---
|
// --- Utilidades ---
|
||||||
void playTitleEffects(); // Reproduce efectos visuales/sonoros del título
|
static void playTitleEffects(); // Reproduce efectos visuales/sonoros del título
|
||||||
void updateDustSprites(); // Actualiza los sprites de polvo
|
void updateDustSprites(); // Actualiza los sprites de polvo
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "manage_hiscore_table.h"
|
#include "manage_hiscore_table.h"
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para SDL_GamepadButton, SDL_ScaleMode, 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
|
||||||
|
#include <stddef.h> // Para size_t
|
||||||
|
|
||||||
#include <algorithm> // Para clamp, max
|
#include <algorithm> // Para clamp, max
|
||||||
#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>
|
#include <functional> // Para function
|
||||||
#include <map>
|
#include <map> // Para map, operator==, _Rb_tree_const_iterator
|
||||||
#include <stdexcept> // Para excepciones de std::stoi
|
#include <stdexcept> // Para invalid_argument, out_of_range
|
||||||
#include <string>
|
#include <string> // Para char_traits, stoi, operator==, operator<<, allocator, string, basic_string, operator<=>, getline
|
||||||
#include <utility> // Para swap
|
#include <utility> // Para swap, pair
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "difficulty.h" // Para Difficulty
|
#include "difficulty.h" // Para Code, init
|
||||||
#include "input.h" // Para InputDevice
|
#include "input.h" // Para InputDevice
|
||||||
#include "lang.h" // Para Code
|
#include "lang.h" // Para Code
|
||||||
#include "utils.h" // Para boolToString, stringToBool, getFileName
|
#include "utils.h" // Para boolToString, stringToBool, getFileName
|
||||||
@@ -209,7 +210,7 @@ auto set(const std::string& var, const std::string& value) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Un mapa estático asegura que se inicializa solo una vez
|
// Un mapa estático asegura que se inicializa solo una vez
|
||||||
static const std::map<std::string, std::function<void(const std::string&)>> settings_map = {
|
static const std::map<std::string, std::function<void(const std::string&)>> SETTINGS_MAP = {
|
||||||
// Ventana
|
// Ventana
|
||||||
{"window.zoom", [](const auto& val) { window.zoom = std::stoi(val); }},
|
{"window.zoom", [](const auto& val) { window.zoom = std::stoi(val); }},
|
||||||
// Vídeo
|
// Vídeo
|
||||||
@@ -252,7 +253,7 @@ auto set(const std::string& var, const std::string& value) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Busca el nombre de la variable en el mapa
|
// Busca el nombre de la variable en el mapa
|
||||||
if (auto it = settings_map.find(var); it != settings_map.end()) {
|
if (auto it = SETTINGS_MAP.find(var); it != SETTINGS_MAP.end()) {
|
||||||
try {
|
try {
|
||||||
// Ejecuta la función lambda asociada
|
// Ejecuta la función lambda asociada
|
||||||
it->second(value);
|
it->second(value);
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
|
|
||||||
#include <algorithm> // Para copy
|
#include <algorithm> // Para copy
|
||||||
#include <string> // Para allocator, string
|
#include <string> // Para allocator, string
|
||||||
#include <utility> // Para move
|
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "difficulty.h" //Para Difficulty
|
#include "difficulty.h" // Para Code
|
||||||
#include "input.h" // Para InputAction, InputDevice
|
#include "input.h" // Para InputAction, InputDevice
|
||||||
#include "lang.h" // Para Code
|
#include "lang.h" // Para Code
|
||||||
#include "manage_hiscore_table.h" // Para HiScoreEntry
|
#include "manage_hiscore_table.h" // Para HiScoreEntry
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 allocator, unique_ptr, shared_ptr
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 string
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 <array> // Para 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
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ class TiledBG;
|
|||||||
|
|
||||||
class Credits {
|
class Credits {
|
||||||
public:
|
public:
|
||||||
// --- Constructores y destructor ---
|
// --- Constructor y destructor ---
|
||||||
Credits();
|
Credits();
|
||||||
~Credits();
|
~Credits();
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#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 "color.h" // Para Color, FLASH_COLOR
|
||||||
|
#include "difficulty.h" // Para Code
|
||||||
#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
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64
|
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64, Uint8
|
||||||
|
|
||||||
#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 "difficulty.h" // Para Difficulty
|
|
||||||
#include "item.h" // Para Item, ItemType
|
#include "item.h" // Para Item, ItemType
|
||||||
#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
|
||||||
#include "path_sprite.h" // Para PathSprite, Path
|
#include "path_sprite.h" // Para PathSprite, Path
|
||||||
#include "player.h" // Para Player
|
#include "player.h" // Para Player
|
||||||
#include "smart_sprite.h" // Para SmartSprite
|
#include "smart_sprite.h" // Para SmartSprite
|
||||||
@@ -26,6 +25,9 @@ class Screen;
|
|||||||
class Tabe;
|
class Tabe;
|
||||||
class Texture;
|
class Texture;
|
||||||
enum class BulletType : Uint8;
|
enum class BulletType : Uint8;
|
||||||
|
namespace Difficulty {
|
||||||
|
enum class Code;
|
||||||
|
} // namespace Difficulty
|
||||||
|
|
||||||
// Modo demo
|
// Modo demo
|
||||||
constexpr bool GAME_MODE_DEMO_OFF = false;
|
constexpr bool GAME_MODE_DEMO_OFF = false;
|
||||||
@@ -37,13 +39,11 @@ constexpr int TOTAL_SCORE_DATA = 3;
|
|||||||
// Clase Game
|
// Clase Game
|
||||||
class Game {
|
class Game {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// --- Constructor y destructor ---
|
||||||
Game(int player_id, int current_stage, bool demo);
|
Game(int player_id, int current_stage, bool demo);
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Game();
|
~Game();
|
||||||
|
|
||||||
// Bucle principal del juego
|
// --- Bucle principal ---
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
@@ -26,13 +27,11 @@ enum class FadeMode : Uint8;
|
|||||||
// Clase HiScoreTable
|
// Clase HiScoreTable
|
||||||
class HiScoreTable {
|
class HiScoreTable {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// --- Constructor y destructor ---
|
||||||
HiScoreTable();
|
HiScoreTable();
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~HiScoreTable();
|
~HiScoreTable();
|
||||||
|
|
||||||
// Bucle principal
|
// --- Bucle principal ---
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
@@ -39,13 +40,11 @@ struct Line {
|
|||||||
// Clase Instructions
|
// Clase Instructions
|
||||||
class Instructions {
|
class Instructions {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// --- Constructor y destructor ---
|
||||||
Instructions();
|
Instructions();
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Instructions();
|
~Instructions();
|
||||||
|
|
||||||
// Bucle principal
|
// --- Bucle principal ---
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -20,13 +20,11 @@
|
|||||||
// Clase Intro
|
// Clase Intro
|
||||||
class Intro {
|
class Intro {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// --- Constructor y destructor ---
|
||||||
Intro();
|
Intro();
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Intro() = default;
|
~Intro() = default;
|
||||||
|
|
||||||
// Bucle principal
|
// --- Bucle principal ---
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -72,8 +70,8 @@ class Intro {
|
|||||||
void updatePostState(); // Actualiza el estado POST
|
void updatePostState(); // Actualiza el estado POST
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
static void adjustColorComponent(uint8_t& component, bool increase);
|
static void adjustColorComponent(uint8_t& component, bool increase);
|
||||||
void adjustAllColorComponents(Color& color, bool increase);
|
static void adjustAllColorComponents(Color& color, bool increase);
|
||||||
void handleDebugColorKeys(SDL_Keycode key, Color& color);
|
static void handleDebugColorKeys(SDL_Keycode key, Color& color);
|
||||||
static void printColorDebugInfo(const Color& color);
|
static void printColorDebugInfo(const Color& color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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 <memory> // Para unique_ptr, shared_ptr
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
@@ -20,13 +21,11 @@ class Texture;
|
|||||||
// --- Clase Logo ---
|
// --- Clase Logo ---
|
||||||
class Logo {
|
class Logo {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// --- Constructor y destructor ---
|
||||||
Logo();
|
Logo();
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Logo();
|
~Logo();
|
||||||
|
|
||||||
// Bucle principal
|
// --- Bucle principal ---
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -118,13 +118,13 @@ void Title::checkEvents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Title::handleKeyDownEvent(const SDL_Event& event) {
|
void Title::handleKeyDownEvent(const SDL_Event& event) {
|
||||||
bool isFirstPress = static_cast<int>(event.key.repeat) == 0;
|
bool is_first_press = static_cast<int>(event.key.repeat) == 0;
|
||||||
if (isFirstPress) {
|
if (is_first_press) {
|
||||||
handleControlKeys(event.key.key);
|
handleControlKeys(event.key.key);
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
bool isRepeat = static_cast<int>(event.key.repeat) == 1;
|
bool is_repeat = static_cast<int>(event.key.repeat) == 1;
|
||||||
if (isRepeat) {
|
if (is_repeat) {
|
||||||
handleDebugColorKeys(event.key.key);
|
handleDebugColorKeys(event.key.key);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -143,15 +143,32 @@ void Title::handleDebugColorKeys(SDL_Keycode key) {
|
|||||||
|
|
||||||
void Title::adjustColorComponent(SDL_Keycode key, Color& color) {
|
void Title::adjustColorComponent(SDL_Keycode key, Color& color) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SDLK_A: incrementColorComponent(color.r); break;
|
case SDLK_A:
|
||||||
case SDLK_Z: decrementColorComponent(color.r); break;
|
incrementColorComponent(color.r);
|
||||||
case SDLK_S: incrementColorComponent(color.g); break;
|
break;
|
||||||
case SDLK_X: decrementColorComponent(color.g); break;
|
case SDLK_Z:
|
||||||
case SDLK_D: incrementColorComponent(color.b); break;
|
decrementColorComponent(color.r);
|
||||||
case SDLK_C: decrementColorComponent(color.b); break;
|
break;
|
||||||
case SDLK_F: incrementAllComponents(color); break;
|
case SDLK_S:
|
||||||
case SDLK_V: decrementAllComponents(color); break;
|
incrementColorComponent(color.g);
|
||||||
default: break;
|
break;
|
||||||
|
case SDLK_X:
|
||||||
|
decrementColorComponent(color.g);
|
||||||
|
break;
|
||||||
|
case SDLK_D:
|
||||||
|
incrementColorComponent(color.b);
|
||||||
|
break;
|
||||||
|
case SDLK_C:
|
||||||
|
decrementColorComponent(color.b);
|
||||||
|
break;
|
||||||
|
case SDLK_F:
|
||||||
|
incrementAllComponents(color);
|
||||||
|
break;
|
||||||
|
case SDLK_V:
|
||||||
|
decrementAllComponents(color);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +252,7 @@ void Title::checkInput() {
|
|||||||
GlobalInputs::check();
|
GlobalInputs::check();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Title::shouldSkipInputCheck() const {
|
auto Title::shouldSkipInputCheck() const -> bool {
|
||||||
return define_buttons_->isEnabled();
|
return define_buttons_->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,13 +264,12 @@ void Title::processControllerInputs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Title::isStartButtonPressed(const Options::GamepadOptions &controller) const {
|
auto Title::isStartButtonPressed(const Options::GamepadOptions& controller) -> bool {
|
||||||
return Input::get()->checkInput(
|
return Input::get()->checkInput(
|
||||||
InputAction::START,
|
InputAction::START,
|
||||||
INPUT_DO_NOT_ALLOW_REPEAT,
|
INPUT_DO_NOT_ALLOW_REPEAT,
|
||||||
controller.type,
|
controller.type,
|
||||||
controller.index
|
controller.index);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Title::handleStartButtonPress(const Options::GamepadOptions& controller) {
|
void Title::handleStartButtonPress(const Options::GamepadOptions& controller) {
|
||||||
@@ -268,7 +284,7 @@ void Title::handleStartButtonPress(const Options::GamepadOptions &controller) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Title::canProcessStartButton() const {
|
auto Title::canProcessStartButton() const -> bool {
|
||||||
return (state_ != TitleState::LOGO_ANIMATING || ALLOW_TITLE_ANIMATION_SKIP);
|
return (state_ != TitleState::LOGO_ANIMATING || ALLOW_TITLE_ANIMATION_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para Uint32
|
#include <SDL3/SDL.h> // Para SDL_Keycode, SDL_Event, Uint64
|
||||||
|
#include <stdint.h> // Para uint8_t
|
||||||
|
|
||||||
#include <memory> // Para unique_ptr, shared_ptr
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
#include <string_view>
|
#include <string_view> // Para string_view
|
||||||
#include <vector>
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "color.h" // Para Color
|
#include "section.hpp" // Para Options, Name (ptr only)
|
||||||
#include "options.h" // Para Options
|
|
||||||
#include "section.hpp" // Para Options
|
|
||||||
|
|
||||||
class DefineButtons;
|
class DefineButtons;
|
||||||
class Fade;
|
class Fade;
|
||||||
@@ -17,6 +16,10 @@ class Player;
|
|||||||
class Sprite;
|
class Sprite;
|
||||||
class Text;
|
class Text;
|
||||||
class TiledBG;
|
class TiledBG;
|
||||||
|
namespace Options {
|
||||||
|
struct GamepadOptions;
|
||||||
|
} // namespace Options
|
||||||
|
struct Color;
|
||||||
|
|
||||||
// Textos
|
// Textos
|
||||||
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";
|
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";
|
||||||
@@ -33,12 +36,12 @@ constexpr bool ALLOW_TITLE_ANIMATION_SKIP = false;
|
|||||||
// Clase Title
|
// Clase Title
|
||||||
class Title {
|
class Title {
|
||||||
public:
|
public:
|
||||||
// --- Constructores y destructor ---
|
// --- Constructor y destructor ---
|
||||||
Title();
|
Title();
|
||||||
~Title();
|
~Title();
|
||||||
|
|
||||||
// --- Método principal ---
|
// --- Bucle principal ---
|
||||||
void run(); // Bucle para el título del juego
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// --- Enumeraciones ---
|
// --- Enumeraciones ---
|
||||||
@@ -88,11 +91,11 @@ class Title {
|
|||||||
void checkInput(); // Comprueba las entradas
|
void checkInput(); // Comprueba las entradas
|
||||||
void handleKeyDownEvent(const SDL_Event& event); // Maneja el evento de tecla presionada
|
void handleKeyDownEvent(const SDL_Event& event); // Maneja el evento de tecla presionada
|
||||||
void handleControlKeys(SDL_Keycode key); // Maneja las teclas de control específicas
|
void handleControlKeys(SDL_Keycode key); // Maneja las teclas de control específicas
|
||||||
bool shouldSkipInputCheck() const; // Determina si se debe omitir la comprobación de entrada
|
[[nodiscard]] auto shouldSkipInputCheck() const -> bool; // Determina si se debe omitir la comprobación de entrada
|
||||||
void processControllerInputs(); // Procesa las entradas de los mandos
|
void processControllerInputs(); // Procesa las entradas de los mandos
|
||||||
bool isStartButtonPressed(const Options::GamepadOptions& controller) const; // Comprueba si se ha pulsado el botón Start
|
[[nodiscard]] static auto isStartButtonPressed(const Options::GamepadOptions& controller) -> bool; // Comprueba si se ha pulsado el botón Start
|
||||||
void handleStartButtonPress(const Options::GamepadOptions& controller); // Maneja la pulsación del botón Start
|
void handleStartButtonPress(const Options::GamepadOptions& controller); // Maneja la pulsación del botón Start
|
||||||
bool canProcessStartButton() const; // Verifica si se puede procesar la pulsación del botón Start
|
[[nodiscard]] auto canProcessStartButton() const -> bool; // Verifica si se puede procesar la pulsación del botón Start
|
||||||
void processPlayer1Start(); // Procesa el inicio del jugador 1
|
void processPlayer1Start(); // Procesa el inicio del jugador 1
|
||||||
void processPlayer2Start(); // Procesa el inicio del jugador 2
|
void processPlayer2Start(); // Procesa el inicio del jugador 2
|
||||||
void activatePlayerAndSetState(int player_id); // Activa al jugador y cambia el estado del título
|
void activatePlayerAndSetState(int player_id); // Activa al jugador y cambia el estado del título
|
||||||
@@ -118,11 +121,11 @@ class Title {
|
|||||||
// --- Depuración (solo en modo DEBUG) ---
|
// --- Depuración (solo en modo DEBUG) ---
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void handleDebugColorKeys(SDL_Keycode key); // Maneja las teclas de depuración para colores
|
void handleDebugColorKeys(SDL_Keycode key); // Maneja las teclas de depuración para colores
|
||||||
void adjustColorComponent(SDL_Keycode key, Color& color); // Ajusta un componente del color según la tecla
|
static void adjustColorComponent(SDL_Keycode key, Color& color); // Ajusta un componente del color según la tecla
|
||||||
void incrementColorComponent(uint8_t& component); // Incrementa un componente de color
|
static void incrementColorComponent(uint8_t& component); // Incrementa un componente de color
|
||||||
void decrementColorComponent(uint8_t& component); // Decrementa un componente de color
|
static void decrementColorComponent(uint8_t& component); // Decrementa un componente de color
|
||||||
void incrementAllComponents(Color& color); // Incrementa todos los componentes del color
|
static void incrementAllComponents(Color& color); // Incrementa todos los componentes del color
|
||||||
void decrementAllComponents(Color& color); // Decrementa todos los componentes del color
|
static void decrementAllComponents(Color& color); // Decrementa todos los componentes del color
|
||||||
void printColorValue(const Color& color); // Imprime el valor actual del color en consola
|
static void printColorValue(const Color& color); // Imprime el valor actual del color en consola
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
@@ -236,7 +237,6 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, const Tex
|
|||||||
writeDX(flags, x, y, text, style.kerning, style.text_color, style.shadow_distance, style.shadow_color);
|
writeDX(flags, x, y, text, style.kerning, style.text_color, style.shadow_distance, style.shadow_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Obtiene la longitud en pixels de una cadena
|
// Obtiene la longitud en pixels de una cadena
|
||||||
auto Text::lenght(const std::string &text, int kerning) const -> int {
|
auto Text::lenght(const std::string &text, int kerning) const -> int {
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para Uint8
|
#include <SDL3/SDL.h> // Para Uint8
|
||||||
|
|
||||||
#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
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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> // Para array
|
||||||
|
|
||||||
#include "color.h" // Para Color
|
#include "color.h" // Para Color
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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> // Para 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
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#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
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#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 <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 clamp, find_if_not, find, transform
|
||||||
#include <cctype> // Para tolower, isspace
|
#include <cctype> // Para tolower, isspace
|
||||||
#include <cmath> // Para pow, sin, M_PI, cos
|
#include <cmath> // Para pow, sin, M_PI, cos
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#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 <cstdint> // Para int32_t
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|||||||
Reference in New Issue
Block a user