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,15 +1,16 @@
|
|||||||
#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 <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 "texture.h" // Para Texture
|
#include <algorithm> // Para min, max
|
||||||
#include "utils.h" // Para printWithDots
|
#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 "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 {
|
||||||
|
|||||||
@@ -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,13 +1,14 @@
|
|||||||
#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;
|
||||||
|
|||||||
@@ -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,12 +1,13 @@
|
|||||||
#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 "color.h" // Para Color
|
#include <array> // Para array
|
||||||
|
#include <cstddef> // Para size_t
|
||||||
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
|
#include <vector> // Para vector
|
||||||
|
|
||||||
|
#include "color.h" // Para Color
|
||||||
|
|
||||||
class MovingSprite;
|
class MovingSprite;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,16 +184,16 @@ class Balloon {
|
|||||||
void applyGravity(); // Aplica la gravedad al objeto
|
void applyGravity(); // Aplica la gravedad al objeto
|
||||||
|
|
||||||
// --- Rebote ---
|
// --- Rebote ---
|
||||||
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
|
||||||
|
|
||||||
// --- Lógica de estado ---
|
// --- Lógica de estado ---
|
||||||
void updateState(); // Actualiza los estados del globo
|
void updateState(); // Actualiza los estados del globo
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para SDL_FRect
|
#include <SDL3/SDL.h> // Para SDL_FRect
|
||||||
#include <algorithm> // Para max
|
|
||||||
#include <array> // Para array
|
#include <algorithm> // Para max
|
||||||
#include <memory> // Para shared_ptr, unique_ptr
|
#include <array> // Para array
|
||||||
#include <string> // Para string
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
#include <vector> // Para vector
|
#include <string> // Para string
|
||||||
|
#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
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para Uint8
|
#include <SDL3/SDL.h> // Para Uint8
|
||||||
#include <memory> // Para unique_ptr
|
|
||||||
#include <string> // Para string
|
#include <memory> // Para unique_ptr
|
||||||
|
#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
|
||||||
|
|||||||
@@ -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 <stdexcept> // Para invalid_argument
|
#include <cctype> // Para isxdigit
|
||||||
#include <string> // Para basic_string, string
|
#include <cmath> // Para sinf, fmaxf, fminf, M_PI, fmodf, roundf, fmod
|
||||||
|
#include <stdexcept> // Para invalid_argument
|
||||||
|
#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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "difficulty.h"
|
#include "difficulty.h"
|
||||||
|
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
|
|
||||||
namespace Difficulty {
|
namespace Difficulty {
|
||||||
|
|
||||||
@@ -10,11 +10,10 @@ 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>& {
|
||||||
return difficulties_list;
|
return difficulties_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,4 +35,4 @@ auto getCodeFromName(const std::string& name) -> Code {
|
|||||||
return !difficulties_list.empty() ? difficulties_list.front().code : Code::NORMAL;
|
return !difficulties_list.empty() ? difficulties_list.front().code : Code::NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Difficulty
|
} // namespace Difficulty
|
||||||
@@ -18,8 +18,8 @@ enum class Code {
|
|||||||
* @brief Estructura que asocia un código de dificultad con su nombre traducible.
|
* @brief Estructura que asocia un código de dificultad con su nombre traducible.
|
||||||
*/
|
*/
|
||||||
struct Info {
|
struct Info {
|
||||||
Code code;
|
Code code;
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Interfaz Pública ---
|
// --- Interfaz Pública ---
|
||||||
@@ -49,4 +49,4 @@ auto getNameFromCode(Code code) -> std::string;
|
|||||||
*/
|
*/
|
||||||
auto getCodeFromName(const std::string& name) -> Code;
|
auto getCodeFromName(const std::string& name) -> Code;
|
||||||
|
|
||||||
} // namespace Difficulty
|
} // namespace Difficulty
|
||||||
@@ -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()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#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
|
||||||
@@ -161,7 +162,7 @@ void GameLogo::handleCoffeeCrisisShaking() {
|
|||||||
} else {
|
} else {
|
||||||
finishCoffeeCrisisShaking();
|
finishCoffeeCrisisShaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDustSprites();
|
updateDustSprites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@ void GameLogo::handleCoffeeCrisisFinished() {
|
|||||||
void GameLogo::handleArcadeEditionMoving() {
|
void GameLogo::handleArcadeEditionMoving() {
|
||||||
zoom_ -= 0.1F * ZOOM_FACTOR;
|
zoom_ -= 0.1F * ZOOM_FACTOR;
|
||||||
arcade_edition_sprite_->setZoom(zoom_);
|
arcade_edition_sprite_->setZoom(zoom_);
|
||||||
|
|
||||||
if (zoom_ <= 1.0F) {
|
if (zoom_ <= 1.0F) {
|
||||||
finishArcadeEditionMoving();
|
finishArcadeEditionMoving();
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,13 +86,13 @@ class GameLogo {
|
|||||||
void updatePostFinishedCounter(); // Actualiza el contador tras finalizar una animación
|
void updatePostFinishedCounter(); // Actualiza el contador tras finalizar una animación
|
||||||
|
|
||||||
// --- Efectos visuales: movimiento y sacudidas ---
|
// --- Efectos visuales: movimiento y sacudidas ---
|
||||||
void handleCoffeeCrisisMoving(); // Maneja el movimiento de "Coffee Crisis"
|
void handleCoffeeCrisisMoving(); // Maneja el movimiento de "Coffee Crisis"
|
||||||
void handleCoffeeCrisisShaking(); // Maneja la sacudida de "Coffee Crisis"
|
void handleCoffeeCrisisShaking(); // Maneja la sacudida de "Coffee Crisis"
|
||||||
void handleArcadeEditionMoving(); // Maneja el movimiento de "Arcade Edition"
|
void handleArcadeEditionMoving(); // Maneja el movimiento de "Arcade Edition"
|
||||||
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,9 +1,10 @@
|
|||||||
#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 <string> // Para string
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
#include <vector> // Para vector
|
#include <string> // Para string
|
||||||
|
#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
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#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 <iterator> // Para distance
|
|
||||||
|
|
||||||
#include "utils.h" // Para getFileName
|
#include <algorithm> // Para find_if, sort
|
||||||
|
#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() {
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
#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
|
||||||
|
|
||||||
namespace Options {
|
namespace Options {
|
||||||
// --- Variables globales ---
|
// --- Variables globales ---
|
||||||
@@ -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
|
||||||
@@ -71,12 +70,12 @@ struct AudioOptions {
|
|||||||
// --- Opciones de configuración ---
|
// --- Opciones de configuración ---
|
||||||
struct SettingsOptions {
|
struct SettingsOptions {
|
||||||
Difficulty::Code difficulty{Difficulty::Code::NORMAL}; // Dificultad del juego
|
Difficulty::Code difficulty{Difficulty::Code::NORMAL}; // Dificultad del juego
|
||||||
Lang::Code language{Lang::Code::VALENCIAN}; // Idioma usado en el juego
|
Lang::Code language{Lang::Code::VALENCIAN}; // Idioma usado en el juego
|
||||||
bool autofire{true}; // Indicador de autofire
|
bool autofire{true}; // Indicador de autofire
|
||||||
bool shutdown_enabled{false}; // Especifica si se puede apagar el sistema
|
bool shutdown_enabled{false}; // Especifica si se puede apagar el sistema
|
||||||
std::vector<HiScoreEntry> hi_score_table; // Tabla de mejores puntuaciones
|
std::vector<HiScoreEntry> hi_score_table; // Tabla de mejores puntuaciones
|
||||||
std::vector<int> last_hi_score_entry; // Últimas posiciones de entrada en la tabla
|
std::vector<int> last_hi_score_entry; // Últimas posiciones de entrada en la tabla
|
||||||
std::string config_file; // Ruta al fichero donde guardar la configuración y las opciones del juego
|
std::string config_file; // Ruta al fichero donde guardar la configuración y las opciones del juego
|
||||||
|
|
||||||
// Constructor por defecto con valores iniciales
|
// Constructor por defecto con valores iniciales
|
||||||
SettingsOptions()
|
SettingsOptions()
|
||||||
@@ -119,9 +118,9 @@ struct GamepadOptions {
|
|||||||
|
|
||||||
// --- Opciones pendientes de aplicar ---
|
// --- Opciones pendientes de aplicar ---
|
||||||
struct PendingChanges {
|
struct PendingChanges {
|
||||||
Lang::Code new_language{Lang::Code::VALENCIAN}; // Idioma en espera de aplicar
|
Lang::Code new_language{Lang::Code::VALENCIAN}; // Idioma en espera de aplicar
|
||||||
Difficulty::Code new_difficulty{Difficulty::Code::NORMAL}; // Dificultad en espera de aplicar
|
Difficulty::Code new_difficulty{Difficulty::Code::NORMAL}; // Dificultad en espera de aplicar
|
||||||
bool has_pending_changes{false}; // Indica si hay cambios pendientes
|
bool has_pending_changes{false}; // Indica si hay cambios pendientes
|
||||||
|
|
||||||
// Constructor por defecto con valores iniciales
|
// Constructor por defecto con valores iniciales
|
||||||
PendingChanges() = default;
|
PendingChanges() = default;
|
||||||
|
|||||||
@@ -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,9 +1,10 @@
|
|||||||
#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 <string> // Para string
|
#include <memory> // Para allocator, unique_ptr, shared_ptr
|
||||||
#include <vector> // Para vector
|
#include <string> // Para string
|
||||||
|
#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
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL3/SDL.h> // Para SDL_FRect
|
#include <SDL3/SDL.h> // Para SDL_FRect
|
||||||
#include <cstddef> // Para size_t
|
|
||||||
#include <memory> // Para shared_ptr
|
#include <cstddef> // Para size_t
|
||||||
#include <string> // Para string
|
#include <memory> // Para shared_ptr
|
||||||
#include <utility> // Para move
|
#include <string> // Para string
|
||||||
#include <vector> // Para vector
|
#include <utility> // Para move
|
||||||
|
#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
|
||||||
|
|||||||
@@ -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,13 +1,14 @@
|
|||||||
#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 "color.h" // Para Color
|
#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 "color.h" // Para Color
|
||||||
|
|
||||||
class Sprite;
|
class Sprite;
|
||||||
class Text;
|
class Text;
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -129,13 +129,13 @@ class Game {
|
|||||||
Options::settings.hi_score_table[0].name,
|
Options::settings.hi_score_table[0].name,
|
||||||
Options::settings.hi_score_table[0].score); // Máxima puntuación y nombre de quien la ostenta
|
Options::settings.hi_score_table[0].score); // Máxima puntuación y nombre de quien la ostenta
|
||||||
|
|
||||||
Demo demo_; // Variable con todas las variables relacionadas con el modo demo
|
Demo demo_; // Variable con todas las variables relacionadas con el modo demo
|
||||||
Difficulty::Code difficulty_ = Options::settings.difficulty; // Dificultad del juego
|
Difficulty::Code difficulty_ = Options::settings.difficulty; // Dificultad del juego
|
||||||
Helper helper_; // Variable para gestionar las ayudas
|
Helper helper_; // Variable para gestionar las ayudas
|
||||||
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
Uint64 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
||||||
bool coffee_machine_enabled_ = false; // Indica si hay una máquina de café en el terreno de juego
|
bool coffee_machine_enabled_ = false; // Indica si hay una máquina de café en el terreno de juego
|
||||||
bool hi_score_achieved_ = false; // Indica si se ha superado la puntuación máxima
|
bool hi_score_achieved_ = false; // Indica si se ha superado la puntuación máxima
|
||||||
bool paused_ = false; // Indica si el juego está pausado (no se deberia de poder utilizar en el modo arcade)
|
bool paused_ = false; // Indica si el juego está pausado (no se deberia de poder utilizar en el modo arcade)
|
||||||
// bool paused_by_service_menu_ = false;
|
// bool paused_by_service_menu_ = false;
|
||||||
float difficulty_score_multiplier_; // Multiplicador de puntos en función de la dificultad
|
float difficulty_score_multiplier_; // Multiplicador de puntos en función de la dificultad
|
||||||
int counter_ = 0; // Contador para el juego
|
int counter_ = 0; // Contador para el juego
|
||||||
|
|||||||
@@ -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,9 +1,10 @@
|
|||||||
#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 <string> // Para string
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
#include <vector> // Para vector
|
#include <string> // Para string
|
||||||
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "color.h" // Para Color
|
#include "color.h" // Para Color
|
||||||
#include "path_sprite.h" // Para Path, PathSprite (ptr only)
|
#include "path_sprite.h" // Para Path, PathSprite (ptr only)
|
||||||
@@ -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,11 +1,12 @@
|
|||||||
#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 "color.h" // Para Color
|
#include <memory> // Para unique_ptr, shared_ptr
|
||||||
#include "sprite.h" // Para Sprite
|
#include <vector> // Para vector
|
||||||
|
|
||||||
|
#include "color.h" // Para Color
|
||||||
|
#include "sprite.h" // Para Sprite
|
||||||
|
|
||||||
class Texture;
|
class Texture;
|
||||||
|
|
||||||
@@ -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:
|
||||||
|
|||||||
@@ -111,31 +111,31 @@ void Title::checkEvents() {
|
|||||||
if (event.type == SDL_EVENT_KEY_DOWN) {
|
if (event.type == SDL_EVENT_KEY_DOWN) {
|
||||||
handleKeyDownEvent(event);
|
handleKeyDownEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalEvents::check(event);
|
GlobalEvents::check(event);
|
||||||
define_buttons_->checkEvents(event);
|
define_buttons_->checkEvents(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void Title::handleDebugColorKeys(SDL_Keycode key) {
|
void Title::handleDebugColorKeys(SDL_Keycode key) {
|
||||||
static Color color_ = param.title.bg_color;
|
static Color color_ = param.title.bg_color;
|
||||||
|
|
||||||
adjustColorComponent(key, color_);
|
adjustColorComponent(key, color_);
|
||||||
|
|
||||||
counter_ = 0;
|
counter_ = 0;
|
||||||
tiled_bg_->setColor(color_);
|
tiled_bg_->setColor(color_);
|
||||||
printColorValue(color_);
|
printColorValue(color_);
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,27 +211,27 @@ void Title::handleControlKeys(SDL_Keycode key) {
|
|||||||
define_buttons_->enable(0);
|
define_buttons_->enable(0);
|
||||||
resetCounter();
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_2:
|
case SDLK_2:
|
||||||
define_buttons_->enable(1);
|
define_buttons_->enable(1);
|
||||||
resetCounter();
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_3:
|
case SDLK_3:
|
||||||
swapControllers();
|
swapControllers();
|
||||||
resetCounter();
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_4:
|
case SDLK_4:
|
||||||
swapKeyboard();
|
swapKeyboard();
|
||||||
resetCounter();
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_5:
|
case SDLK_5:
|
||||||
showControllers();
|
showControllers();
|
||||||
resetCounter();
|
resetCounter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -235,28 +252,27 @@ void Title::checkInput() {
|
|||||||
GlobalInputs::check();
|
GlobalInputs::check();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Title::shouldSkipInputCheck() const {
|
auto Title::shouldSkipInputCheck() const -> bool {
|
||||||
return define_buttons_->isEnabled();
|
return define_buttons_->isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Title::processControllerInputs() {
|
void Title::processControllerInputs() {
|
||||||
for (const auto &controller : Options::controllers) {
|
for (const auto& controller : Options::controllers) {
|
||||||
if (isStartButtonPressed(controller)) {
|
if (isStartButtonPressed(controller)) {
|
||||||
handleStartButtonPress(controller);
|
handleStartButtonPress(controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
if (!canProcessStartButton()) {
|
if (!canProcessStartButton()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,21 +562,21 @@ void Title::initPlayers() {
|
|||||||
|
|
||||||
// Actualza los jugadores
|
// Actualza los jugadores
|
||||||
void Title::updatePlayers() {
|
void Title::updatePlayers() {
|
||||||
for (auto &player : players_) {
|
for (auto& player : players_) {
|
||||||
player->update();
|
player->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renderiza los jugadores
|
// Renderiza los jugadores
|
||||||
void Title::renderPlayers() {
|
void Title::renderPlayers() {
|
||||||
for (auto const &player : players_) {
|
for (auto const& player : players_) {
|
||||||
player->render();
|
player->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene un jugador a partir de su "id"
|
// Obtiene un jugador a partir de su "id"
|
||||||
auto Title::getPlayer(int id) -> std::shared_ptr<Player> {
|
auto Title::getPlayer(int id) -> std::shared_ptr<Player> {
|
||||||
auto it = std::find_if(players_.begin(), players_.end(), [id](const auto &player) { return player->getId() == id; });
|
auto it = std::find_if(players_.begin(), players_.end(), [id](const auto& player) { return player->getId() == id; });
|
||||||
|
|
||||||
if (it != players_.end()) {
|
if (it != players_.end()) {
|
||||||
return *it;
|
return *it;
|
||||||
|
|||||||
@@ -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 ---
|
||||||
@@ -84,18 +87,18 @@ class Title {
|
|||||||
void resetCounter(); // Reinicia el contador interno
|
void resetCounter(); // Reinicia el contador interno
|
||||||
|
|
||||||
// --- Entrada de usuario ---
|
// --- Entrada de usuario ---
|
||||||
void checkEvents(); // Comprueba los eventos
|
void checkEvents(); // Comprueba los eventos
|
||||||
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
|
||||||
|
|
||||||
// --- Gestión de jugadores ---
|
// --- Gestión de jugadores ---
|
||||||
void initPlayers(); // Inicializa los jugadores
|
void initPlayers(); // Inicializa los jugadores
|
||||||
@@ -117,12 +120,12 @@ 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,9 +2,10 @@
|
|||||||
#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 <array> // Para array
|
#include <algorithm> // Para max
|
||||||
#include <cstdlib> // Para rand, abs
|
#include <array> // Para array
|
||||||
|
#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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -232,11 +233,10 @@ void Text::writeDX(Uint8 flags, int x, int y, const std::string &text, int kerni
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Escribe texto a partir de un TextStyle
|
// Escribe texto a partir de un TextStyle
|
||||||
void Text::writeDX(Uint8 flags, int x, int y, const std::string& text, const TextStyle& style, int length) {
|
void Text::writeDX(Uint8 flags, int x, int y, const std::string &text, const TextStyle &style, int length) {
|
||||||
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,12 +1,13 @@
|
|||||||
#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 "color.h" // Para Color
|
#include <array> // Para array
|
||||||
#include "sprite.h" // Para Sprite
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
|
#include <string> // Para string
|
||||||
|
|
||||||
|
#include "color.h" // Para Color
|
||||||
|
#include "sprite.h" // Para Sprite
|
||||||
|
|
||||||
class Texture;
|
class Texture;
|
||||||
|
|
||||||
|
|||||||
@@ -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,9 +1,10 @@
|
|||||||
#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 "color.h" // Para Color
|
#include <array> // Para array
|
||||||
|
|
||||||
|
#include "color.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 {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#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 "color.h" // Para Color, generateMirroredCycle, ColorCycleStyle
|
||||||
#include "menu_option.h" // Para MenuOption
|
#include "menu_option.h" // Para MenuOption
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#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 <cstddef> // Para size_t
|
#include <array> // Para array
|
||||||
#include <memory> // Para shared_ptr, unique_ptr
|
#include <cstddef> // Para size_t
|
||||||
#include <vector> // Para vector
|
#include <memory> // Para shared_ptr, unique_ptr
|
||||||
|
#include <vector> // Para vector
|
||||||
|
|
||||||
#include "color.h" // Para Color
|
#include "color.h" // Para Color
|
||||||
#include "ui/service_menu.h" // Para ServiceMenu
|
#include "ui/service_menu.h" // Para ServiceMenu
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <algorithm> // Para max
|
#include <algorithm> // Para max
|
||||||
|
|
||||||
#include "audio.h" // Para Audio
|
#include "audio.h" // Para Audio
|
||||||
#include "difficulty.h" // Para Difficulty
|
#include "difficulty.h" // Para Difficulty
|
||||||
#include "lang.h" // Para getText, getCodeFromName, getNameFromCode
|
#include "lang.h" // Para getText, getCodeFromName, getNameFromCode
|
||||||
#include "menu_option.h" // Para MenuOption, BoolOption, ActionOption, IntOption, FolderOption, ListOption
|
#include "menu_option.h" // Para MenuOption, BoolOption, ActionOption, IntOption, FolderOption, ListOption
|
||||||
#include "menu_renderer.h" // Para MenuRenderer
|
#include "menu_renderer.h" // Para MenuRenderer
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory> // Para shared_ptr
|
#include <memory> // Para shared_ptr
|
||||||
#include <string> // Para string
|
#include <string> // Para string
|
||||||
|
|
||||||
#include "color.h" // Para Color
|
#include "color.h" // Para Color
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
#include <stdexcept> // Para runtime_error
|
#include <stdexcept> // Para runtime_error
|
||||||
#include <string> // Para basic_string, allocator, string, operator==, operator+, 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();
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
#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 <string> // Para string
|
#include <cstdint> // Para int32_t
|
||||||
#include <vector> // Para vector
|
#include <string> // Para string
|
||||||
|
#include <vector> // Para vector
|
||||||
|
|
||||||
// --- Constantes ---
|
// --- Constantes ---
|
||||||
constexpr int BLOCK = 8;
|
constexpr int BLOCK = 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user