afegit define NO_AUDIO

renombrat define DEBUG a _DEBUG
This commit is contained in:
2025-07-23 09:24:04 +02:00
parent 921975851a
commit 74c1c096f8
14 changed files with 138 additions and 88 deletions

View File

@@ -1,11 +1,12 @@
#include "game.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_EventType, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_Event, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
#include <algorithm> // Para max, find_if, clamp, find, min
#include <array> // Para array
#include <cstdlib> // Para rand, size_t
#include <functional> // Para function
#include <iterator> // Para distance, size
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_EventType, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_Event, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
#include <algorithm> // Para max, find_if, clamp, find, min
#include <array> // Para array
#include <cstdlib> // Para rand, size_t
#include <functional> // Para function
#include <iterator> // Para distance, size
#include "asset.h" // Para Asset
#include "audio.h" // Para Audio
@@ -88,7 +89,7 @@ Game::Game(int player_id, int current_stage, bool demo)
initPaths();
setTotalPower();
#ifdef DEBUG
#ifdef _DEBUG
// Si se empieza en una fase que no es la primera
if (!demo_.enabled) {
for (int i = 0; i < Stage::number; ++i) {
@@ -1120,7 +1121,7 @@ void Game::checkEvents() {
break;
}
#ifdef DEBUG
#ifdef _DEBUG
checkDebugEvents(event);
#endif
GlobalEvents::check(event);
@@ -1685,7 +1686,7 @@ void Game::updateGameStateShowingGetReadyMessage() {
// Actualiza las variables durante el transcurso normal del juego
void Game::updateGameStatePlaying() {
#ifdef DEBUG
#ifdef _DEBUG
if (auto_pop_balloons_) {
Stage::addPower(5);
}
@@ -1818,7 +1819,7 @@ void Game::checkServiceMenu() {
service_menu_was_active_ = service_menu_is_active;
}
#ifdef DEBUG
#ifdef _DEBUG
// Comprueba los eventos en el modo DEBUG
void Game::checkDebugEvents(const SDL_Event &event) {
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {

View File

@@ -1,9 +1,10 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
#include "item.h" // Para Item, ItemType
#include "manage_hiscore_table.h" // Para HiScoreEntry
@@ -146,7 +147,7 @@ class Game {
GameState state_ = GameState::FADE_IN; // Estado
std::vector<std::shared_ptr<Player>> players_to_reorder_;
#ifdef DEBUG
#ifdef _DEBUG
bool auto_pop_balloons_ = false; // Si es true, incrementa automaticamente los globos explotados
// Comprueba los eventos en el modo DEBUG

View File

@@ -1,6 +1,7 @@
#include "intro.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_Event, SDL_EventType, Uint32
#include <algorithm> // Para max
#include <array> // Para array
#include <functional> // Para function
@@ -25,7 +26,7 @@
#include "utils.h"
#include "writer.h" // Para Writer
#ifdef DEBUG
#ifdef _DEBUG
#include <iomanip> // Para operator<<, setfill, setw
#endif
@@ -51,7 +52,7 @@ Intro::Intro()
void Intro::checkEvents() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
#ifdef DEBUG
#ifdef _DEBUG
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 1) {
static Color color_ = param.intro.bg_color;
handleDebugColorKeys(event.key.key, color_);
@@ -536,7 +537,7 @@ void Intro::renderTextRect() {
SDL_RenderFillRect(Screen::get()->getRenderer(), &rect_);
}
#ifdef DEBUG
#ifdef _DEBUG
// Helper functions for color adjustment
void Intro::adjustColorComponent(uint8_t &component, bool increase) {
if (increase && component < 255) {

View File

@@ -1,9 +1,10 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_Keycode, Uint32, Uint64
#include <stdint.h> // Para uint8_t
#include <memory> // Para unique_ptr
#include <vector> // Para vector
#include <SDL3/SDL.h> // Para SDL_Keycode, Uint32, Uint64
#include <stdint.h> // Para uint8_t
#include <memory> // Para unique_ptr
#include <vector> // Para vector
#include "color.h" // Para Color
#include "param.h" // Para Param, ParamIntro, param
@@ -69,7 +70,7 @@ class Intro {
void renderTexts(); // Dibuja los textos
static void renderTextRect(); // Dibuja el rectangulo de fondo del texto;
void updatePostState(); // Actualiza el estado POST
#ifdef DEBUG
#ifdef _DEBUG
void adjustColorComponent(uint8_t& component, bool increase);
void adjustAllColorComponents(Color& color, bool increase);
void handleDebugColorKeys(SDL_Keycode key, Color& color);

View File

@@ -1,6 +1,7 @@
#include "title.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_EventType
#include <algorithm> // Para find_if
#include <cstddef> // Para size_t
#include <iostream> // Para basic_ostream, basic_ostream::operator<<
@@ -31,7 +32,7 @@
class Texture;
#ifdef DEBUG
#ifdef _DEBUG
#include <iomanip> // Para operator<<, setfill, setw
#endif
@@ -107,7 +108,7 @@ void Title::render() {
void Title::checkEvents() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
#ifdef DEBUG
#ifdef _DEBUG
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 1) {
static Color color_ = param.title.bg_color;
switch (event.key.key) {