diff --git a/CMakeLists.txt b/CMakeLists.txt index 323398d..ca8574d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ set(APP_SOURCES # Fuentes de librerías de terceros set(EXTERNAL_SOURCES - source/external/jail_audio.cpp + #source/external/jail_audio.cpp source/external/jail_shader.cpp source/external/json.hpp source/external/gif.cpp @@ -113,7 +113,10 @@ target_compile_options(${PROJECT_NAME} PRIVATE -Wall) target_compile_options(${PROJECT_NAME} PRIVATE $<$:-Os -ffunction-sections -fdata-sections>) # Definir _DEBUG en modo Debug -target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:DEBUG>) +target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:_DEBUG>) + +# Definir NO_AUDIO en todas las configuraciones +target_compile_definitions(${PROJECT_NAME} PRIVATE NO_AUDIO) # Configuración específica para cada plataforma if(WIN32) diff --git a/source/audio.cpp b/source/audio.cpp index 9ef8ce8..5f5ce13 100644 --- a/source/audio.cpp +++ b/source/audio.cpp @@ -1,11 +1,14 @@ #include "audio.h" #include // Para SDL_LogInfo, SDL_LogCategory, SDL_G... + #include // Para clamp +#ifndef NO_AUDIO #include "external/jail_audio.h" // Para JA_FadeOutMusic, JA_Init, JA_PauseM... -#include "options.h" // Para AudioOptions, audio, MusicOptions -#include "resource.h" // Para Resource +#endif +#include "options.h" // Para AudioOptions, audio, MusicOptions +#include "resource.h" // Para Resource // Singleton Audio *Audio::instance = nullptr; @@ -23,7 +26,11 @@ auto Audio::get() -> Audio * { return Audio::instance; } Audio::Audio() { initSDLAudio(); } // Destructor -Audio::~Audio() { JA_Quit(); } +Audio::~Audio() { +#ifndef NO_AUDIO + JA_Quit(); +#endif +} // Reproduce la música void Audio::playMusic(const std::string &name, const int loop) { @@ -31,7 +38,9 @@ void Audio::playMusic(const std::string &name, const int loop) { music_.loop = (loop != 0); if (music_enabled_ && music_.state != MusicState::PLAYING) { +#ifndef NO_AUDIO JA_PlayMusic(Resource::get()->getMusic(name), loop); +#endif music_.state = MusicState::PLAYING; } } @@ -39,7 +48,9 @@ void Audio::playMusic(const std::string &name, const int loop) { // Pausa la música void Audio::pauseMusic() { if (music_enabled_ && music_.state == MusicState::PLAYING) { +#ifndef NO_AUDIO JA_PauseMusic(); +#endif music_.state = MusicState::PAUSED; } } @@ -47,7 +58,9 @@ void Audio::pauseMusic() { // Detiene la música void Audio::stopMusic() { if (music_enabled_) { +#ifndef NO_AUDIO JA_StopMusic(); +#endif music_.state = MusicState::STOPPED; } } @@ -55,21 +68,27 @@ void Audio::stopMusic() { // Reproduce un sonido void Audio::playSound(const std::string &name, Group group) const { if (sound_enabled_) { +#ifndef NO_AUDIO JA_PlaySound(Resource::get()->getSound(name), 0, static_cast(group)); +#endif } } // Detiene todos los sonidos void Audio::stopAllSounds() const { if (sound_enabled_) { +#ifndef NO_AUDIO JA_StopChannel(-1); +#endif } } // Realiza un fundido de salida de la música void Audio::fadeOutMusic(int milliseconds) const { if (music_enabled_) { +#ifndef NO_AUDIO JA_FadeOutMusic(milliseconds); +#endif } } @@ -77,8 +96,10 @@ void Audio::fadeOutMusic(int milliseconds) const { void Audio::setSoundVolume(int sound_volume, Group group) const { if (sound_enabled_) { sound_volume = std::clamp(sound_volume, MIN_VOLUME, MAX_VOLUME); +#ifndef NO_AUDIO const float CONVERTED_VOLUME = (sound_volume / 100.0F) * (Options::audio.volume / 100.0F); JA_SetSoundVolume(CONVERTED_VOLUME, static_cast(group)); +#endif } } @@ -86,8 +107,10 @@ void Audio::setSoundVolume(int sound_volume, Group group) const { void Audio::setMusicVolume(int music_volume) const { if (music_enabled_) { music_volume = std::clamp(music_volume, MIN_VOLUME, MAX_VOLUME); +#ifndef NO_AUDIO const float CONVERTED_VOLUME = (music_volume / 100.0F) * (Options::audio.volume / 100.0F); JA_SetMusicVolume(CONVERTED_VOLUME); +#endif } } @@ -106,14 +129,16 @@ void Audio::enable(bool value) { // Inicializa SDL Audio void Audio::initSDLAudio() { +#ifndef NO_AUDIO if (!SDL_Init(SDL_INIT_AUDIO)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_AUDIO could not initialize! SDL Error: %s", SDL_GetError()); } else { - SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "\n** SDL_AUDIO: INITIALIZING\n"); - JA_Init(FREQUENCY, SDL_AUDIO_S16LE, 2); enable(Options::audio.enabled); - SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "** SDL_AUDIO: INITIALIZATION COMPLETE\n"); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Audio system initialized successfully"); } +#else + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Audio system disabled"); +#endif } \ No newline at end of file diff --git a/source/director.cpp b/source/director.cpp index 8e26fd4..6cbbad4 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -1,19 +1,20 @@ // IWYU pragma: no_include #include "director.h" -#include // Para SDL_Scancode, SDL_GamepadButton, SDL_LogCategory, SDL_LogInfo, SDL_SetLogPriority, SDL_LogPriority, SDL_Quit -#include // Para mkdir, stat, S_IRWXU -#include // Para getuid -#include // Para min -#include // Para errno, EEXIST, EACCES, ENAMETOOLONG -#include // Para printf, perror -#include // Para exit, EXIT_FAILURE, size_t, srand, rand, system -#include // Para time -#include // Para make_unique, unique_ptr -#include // Para span -#include // Para runtime_error -#include // Para operator+, allocator, char_traits, operator==, string, basic_string -#include // Para vector +#include // Para SDL_Scancode, SDL_GamepadButton, SDL_LogCategory, SDL_LogInfo, SDL_SetLogPriority, SDL_LogPriority, SDL_Quit +#include // Para mkdir, stat, S_IRWXU +#include // Para getuid + +#include // Para min +#include // Para errno, EEXIST, EACCES, ENAMETOOLONG +#include // Para printf, perror +#include // Para exit, EXIT_FAILURE, size_t, srand, rand, system +#include // Para time +#include // Para make_unique, unique_ptr +#include // Para span +#include // Para runtime_error +#include // Para operator+, allocator, char_traits, operator==, string, basic_string +#include // Para vector #include "asset.h" // Para Asset, AssetType #include "audio.h" // Para Audio @@ -37,7 +38,7 @@ #include "utils.h" // Para Overrides, overrides, getPath #ifndef _WIN32 -#include // Para getpwuid, passwd +#include // Para getpwuid, passwd #endif // Constructor @@ -45,7 +46,7 @@ Director::Director(int argc, std::span argv) { #ifdef RECORDING Section::name = Section::Name::GAME; Section::options = Section::Options::GAME_PLAY_1P; -#elif DEBUG +#elif _DEBUG Section::name = Section::Name::GAME; Section::options = Section::Options::GAME_PLAY_1P; #else // NORMAL GAME @@ -134,7 +135,7 @@ void Director::loadParams() { // Carga el fichero de puntuaciones void Director::loadScoreFile() { auto manager = std::make_unique(Options::settings.hi_score_table); -#ifdef DEBUG +#ifdef _DEBUG manager->clear(); #else if (overrides.clear_hi_score_table) { @@ -546,7 +547,7 @@ void Director::runGame() { break; } -#ifdef DEBUG +#ifdef _DEBUG constexpr int CURRENT_STAGE = 0; #else constexpr int CURRENT_STAGE = 0; diff --git a/source/external/jail_audio.cpp b/source/external/jail_audio.cpp index 3f2f33a..da7c848 100644 --- a/source/external/jail_audio.cpp +++ b/source/external/jail_audio.cpp @@ -102,7 +102,7 @@ Uint32 JA_UpdateCallback(void *userdata, SDL_TimerID timerID, Uint32 interval) { } void JA_Init(const int freq, const SDL_AudioFormat format, const int num_channels) { -#ifdef DEBUG +#ifdef _DEBUG SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG); #endif diff --git a/source/external/jail_shader.cpp b/source/external/jail_shader.cpp index daf44bf..fe49e5a 100644 --- a/source/external/jail_shader.cpp +++ b/source/external/jail_shader.cpp @@ -276,7 +276,7 @@ bool init(SDL_Window *window, SDL_Texture *back_buffer_texture, const std::strin } usingOpenGL = true; - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Shader system initialized successfully."); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Shader system initialized successfully"); return true; } diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index 5decde5..4e763e1 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -1,7 +1,7 @@ #include "global_inputs.h" -#include // Para operator+, allocator, char_traits, to_string, string -#include // Para vector +#include // Para operator+, allocator, char_traits, to_string, string +#include // Para vector #include "asset.h" // Para Asset #include "audio.h" // Para Audio @@ -350,7 +350,7 @@ auto checkInputs() -> bool { return true; } -#ifdef DEBUG +#ifdef _DEBUG // Debug info if (Input::get()->checkInput(InputAction::SHOW_INFO, INPUT_DO_NOT_ALLOW_REPEAT, InputDevice::KEYBOARD)) { Screen::get()->toggleDebugInfo(); diff --git a/source/resource.cpp b/source/resource.cpp index 2b25628..556b948 100644 --- a/source/resource.cpp +++ b/source/resource.cpp @@ -1,19 +1,22 @@ #include "resource.h" -#include // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_SetRenderDrawColor, SDL_EventType, SDL_PollEvent, SDL_RenderFillRect, SDL_RenderRect, SDLK_ESCAPE, SDL_Event -#include // Para find_if, max -#include // Para array -#include // Para exit -#include // Para runtime_error -#include // Para move +#include // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_SetRenderDrawColor, SDL_EventType, SDL_PollEvent, SDL_RenderFillRect, SDL_RenderRect, SDLK_ESCAPE, SDL_Event -#include "asset.h" // Para Asset, AssetType -#include "color.h" // Para Color +#include // Para find_if, max +#include // Para array +#include // Para exit +#include // Para runtime_error +#include // Para move + +#include "asset.h" // Para Asset, AssetType +#include "color.h" // Para Color +#ifndef NO_AUDIO #include "external/jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_LoadMusic, JA_LoadSound -#include "lang.h" // Para getText -#include "param.h" // Para Param, param, ParamResource, ParamGame -#include "screen.h" // Para Screen -#include "text.h" // Para Text, loadTextFile, TextFile (ptr only) +#endif +#include "lang.h" // Para getText +#include "param.h" // Para Param, param, ParamResource, ParamGame +#include "screen.h" // Para Screen +#include "text.h" // Para Text, loadTextFile, TextFile (ptr only) struct JA_Music_t; // lines 11-11 struct JA_Sound_t; // lines 12-12 @@ -38,8 +41,10 @@ Resource::~Resource() { clear(); } // Vacia todos los vectores de recursos void Resource::clear() { +#ifndef NO_AUDIO clearSounds(); clearMusics(); +#endif textures_.clear(); text_files_.clear(); texts_.clear(); @@ -59,8 +64,10 @@ void Resource::load() { screen->setVSync(false); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES"); - loadSounds(); // Carga sonidos - loadMusics(); // Carga músicas +#ifndef NO_AUDIO + loadSounds(); // Carga sonidos + loadMusics(); // Carga músicas +#endif loadTextures(); // Carga texturas loadTextFiles(); // Carga ficheros de texto loadAnimations(); // Carga animaciones @@ -173,7 +180,9 @@ void Resource::loadSounds() { for (const auto &l : list) { auto name = getFileName(l); updateLoadingProgress(name); +#ifndef NO_AUDIO sounds_.emplace_back(name, JA_LoadSound(l.c_str())); +#endif printWithDots("Sound : ", name, "[ LOADED ]"); } } @@ -187,7 +196,9 @@ void Resource::loadMusics() { for (const auto &l : list) { auto name = getFileName(l); updateLoadingProgress(name); +#ifndef NO_AUDIO musics_.emplace_back(name, JA_LoadMusic(l.c_str())); +#endif printWithDots("Music : ", name, "[ LOADED ]"); } } @@ -338,7 +349,9 @@ void Resource::createText() { void Resource::clearSounds() { for (auto &sound : sounds_) { if (sound.sound != nullptr) { +#ifndef NO_AUDIO JA_DeleteSound(sound.sound); +#endif sound.sound = nullptr; } } @@ -349,7 +362,9 @@ void Resource::clearSounds() { void Resource::clearMusics() { for (auto &music : musics_) { if (music.music != nullptr) { +#ifndef NO_AUDIO JA_DeleteMusic(music.music); +#endif music.music = nullptr; } } diff --git a/source/screen.cpp b/source/screen.cpp index 7825838..c795b81 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -1,11 +1,12 @@ #include "screen.h" -#include // Para SDL_SetRenderTarget, SDL_LogCategory, SDL_LogInfo, SDL_RenderTexture, SDL_SetRenderDrawColor, SDL_SetRenderVSync, SDL_GetError, SDL_LogError, SDL_RendererLogicalPresentation, SDL_SetRenderLogicalPresentation, SDL_CreateTexture, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetTicks, SDL_Quit, SDL_RENDERER_VSYNC_DISABLED, SDL_RenderClear, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DisplayID, SDL_FRect, SDL_GetCurrentDisplayMode, SDL_GetDisplayName, SDL_GetDisplays, SDL_GetRenderTarget, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_Init, SDL_LogWarn, SDL_PixelFormat, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetHint, SDL_SetRenderDrawBlendMode, SDL_SetTextureScaleMode, SDL_SetWindowFullscreen, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_TextureAccess, SDL_free, SDL_BLENDMODE_BLEND, SDL_HINT_RENDER_DRIVER, SDL_INIT_VIDEO, SDL_PRIu32, SDL_ScaleMode, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WindowFlags -#include // Para min, max -#include // Para basic_ifstream, ifstream -#include // Para istreambuf_iterator, operator== -#include // Para allocator, shared_ptr, make_shared, __shared_ptr_access -#include // Para operator+, char_traits, to_string, string +#include // Para SDL_SetRenderTarget, SDL_LogCategory, SDL_LogInfo, SDL_RenderTexture, SDL_SetRenderDrawColor, SDL_SetRenderVSync, SDL_GetError, SDL_LogError, SDL_RendererLogicalPresentation, SDL_SetRenderLogicalPresentation, SDL_CreateTexture, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetTicks, SDL_Quit, SDL_RENDERER_VSYNC_DISABLED, SDL_RenderClear, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DisplayID, SDL_FRect, SDL_GetCurrentDisplayMode, SDL_GetDisplayName, SDL_GetDisplays, SDL_GetRenderTarget, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_Init, SDL_LogWarn, SDL_PixelFormat, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetHint, SDL_SetRenderDrawBlendMode, SDL_SetTextureScaleMode, SDL_SetWindowFullscreen, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_TextureAccess, SDL_free, SDL_BLENDMODE_BLEND, SDL_HINT_RENDER_DRIVER, SDL_INIT_VIDEO, SDL_PRIu32, SDL_ScaleMode, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WindowFlags + +#include // Para min, max +#include // Para basic_ifstream, ifstream +#include // Para istreambuf_iterator, operator== +#include // Para allocator, shared_ptr, make_shared, __shared_ptr_access +#include // Para operator+, char_traits, to_string, string #include "asset.h" // Para Asset #include "external/jail_shader.h" // Para init, render @@ -49,7 +50,7 @@ Screen::Screen() // Crea el objeto de texto createText(); -#ifdef DEBUG +#ifdef _DEBUG debug_info_.text = text_; setDebugInfoEnabled(true); #endif @@ -86,7 +87,7 @@ void Screen::render() { // Vuelca el contenido del renderizador en pantalla exceptuando ciertas partes void Screen::coreRender() { fps_.increment(); -#ifdef DEBUG +#ifdef _DEBUG renderInfo(); #endif renderScreen(); // Renderiza el contenido del game_canvas_ @@ -206,7 +207,7 @@ void Screen::renderShake() { SDL_SetRenderTarget(renderer_, current_target); } } -#ifdef DEBUG +#ifdef _DEBUG // Muestra información por pantalla void Screen::renderInfo() { if (debug_info_.show) { @@ -267,7 +268,7 @@ void Screen::renderOverlays() { renderAttenuate(); service_menu_->render(); notifier_->render(); -#ifdef DEBUG +#ifdef _DEBUG renderInfo(); #endif } @@ -335,9 +336,8 @@ auto Screen::initSDLVideo() -> bool { SDL_SetRenderLogicalPresentation(renderer_, param.game.width, param.game.height, Options::video.integer_scale ? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE : SDL_LOGICAL_PRESENTATION_LETTERBOX); SDL_SetRenderDrawBlendMode(renderer_, SDL_BLENDMODE_BLEND); SDL_SetRenderVSync(renderer_, Options::video.v_sync ? 1 : SDL_RENDERER_VSYNC_DISABLED); - // SDL_SetWindowFullscreen(window_, Options::video.fullscreen); - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "SDL Video initialized successfully."); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** Video system initialized successfully"); return true; } diff --git a/source/screen.h b/source/screen.h index 6cb1a4d..8090642 100644 --- a/source/screen.h +++ b/source/screen.h @@ -1,11 +1,12 @@ #pragma once #include // Para SDL_FRect, SDL_HideWindow, SDL_Renderer, SDL_ShowWindow, Uint32, SDL_Texture, SDL_Window -#include // Para shared_ptr -#include // Para string -#include "color.h" // Para Color -#include "options.h" // Para VideoOptions, video +#include // Para shared_ptr +#include // Para string + +#include "color.h" // Para Color +#include "options.h" // Para VideoOptions, video class Notifier; class ServiceMenu; @@ -53,7 +54,7 @@ class Screen { [[nodiscard]] static auto getVSync() -> bool { return Options::video.v_sync; } // Obtiene el valor de V-Sync [[nodiscard]] auto getText() const -> std::shared_ptr { return text_; } // Obtiene el puntero al texto de Screen -#ifdef DEBUG +#ifdef _DEBUG // --- Debug --- void toggleDebugInfo() { debug_info_.show = !debug_info_.show; } void setDebugInfoEnabled(bool value) { debug_info_.show = value; } @@ -161,7 +162,7 @@ class Screen { [[nodiscard]] auto isEnabled() const -> bool { return enabled; } }; -#ifdef DEBUG +#ifdef _DEBUG struct Debug { std::shared_ptr text; bool show = false; @@ -187,7 +188,7 @@ class Screen { FlashEffect flash_effect_; // Efecto de flash en pantalla ShakeEffect shake_effect_; // Efecto de agitar la pantalla bool attenuate_effect_ = false; // Indica si la pantalla ha de estar atenuada -#ifdef DEBUG +#ifdef _DEBUG Debug debug_info_; // Información de debug #endif diff --git a/source/sections/game.cpp b/source/sections/game.cpp index d632c28..d2e1ae8 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -1,11 +1,12 @@ #include "game.h" -#include // 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 // Para max, find_if, clamp, find, min -#include // Para array -#include // Para rand, size_t -#include // Para function -#include // Para distance, size +#include // 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 // Para max, find_if, clamp, find, min +#include // Para array +#include // Para rand, size_t +#include // Para function +#include // 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(event.key.repeat) == 0) { diff --git a/source/sections/game.h b/source/sections/game.h index dbfb2f0..55f406a 100644 --- a/source/sections/game.h +++ b/source/sections/game.h @@ -1,9 +1,10 @@ #pragma once -#include // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64 -#include // Para shared_ptr, unique_ptr -#include // Para string -#include // Para vector +#include // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64 + +#include // Para shared_ptr, unique_ptr +#include // Para string +#include // 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> 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 diff --git a/source/sections/intro.cpp b/source/sections/intro.cpp index 4b527fe..dc9d324 100644 --- a/source/sections/intro.cpp +++ b/source/sections/intro.cpp @@ -1,6 +1,7 @@ #include "intro.h" #include // 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 // Para max #include // Para array #include // Para function @@ -25,7 +26,7 @@ #include "utils.h" #include "writer.h" // Para Writer -#ifdef DEBUG +#ifdef _DEBUG #include // 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(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) { diff --git a/source/sections/intro.h b/source/sections/intro.h index eb802c3..e6cdc68 100644 --- a/source/sections/intro.h +++ b/source/sections/intro.h @@ -1,9 +1,10 @@ #pragma once -#include // Para SDL_Keycode, Uint32, Uint64 -#include // Para uint8_t -#include // Para unique_ptr -#include // Para vector +#include // Para SDL_Keycode, Uint32, Uint64 +#include // Para uint8_t + +#include // Para unique_ptr +#include // 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); diff --git a/source/sections/title.cpp b/source/sections/title.cpp index 28e9693..da4ddf7 100644 --- a/source/sections/title.cpp +++ b/source/sections/title.cpp @@ -1,6 +1,7 @@ #include "title.h" #include // Para SDL_GetTicks, Uint32, SDL_EventType + #include // Para find_if #include // Para size_t #include // Para basic_ostream, basic_ostream::operator<< @@ -31,7 +32,7 @@ class Texture; -#ifdef DEBUG +#ifdef _DEBUG #include // 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(event.key.repeat) == 1) { static Color color_ = param.title.bg_color; switch (event.key.key) {