From 9825c7fb9b36c4ffcd602dcf017238b967d5b45c Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 13 Oct 2024 21:58:36 +0200 Subject: [PATCH] Pasaeta de include-what-you-use --- source/hiscore_table.h | 14 ++++++-------- source/instructions.cpp | 15 ++++++++------- source/instructions.h | 23 +++++++++++------------ source/intro.cpp | 36 ++++++++++++++++++------------------ source/intro.h | 17 ++++++++--------- source/item.h | 16 ++++++++-------- source/logo.cpp | 27 ++++++++++++++------------- source/logo.h | 15 +++++++-------- source/main.cpp | 7 +++---- source/moving_sprite.h | 12 ++++++------ source/notify.cpp | 17 ++++++++--------- source/notify.h | 20 ++++++++++---------- source/on_screen_help.cpp | 23 +++++++++++------------ source/on_screen_help.h | 11 +++++------ source/player.h | 21 +++++++++++---------- source/scoreboard.h | 20 ++++++++++---------- source/smart_sprite.h | 6 +++--- source/text.cpp | 11 ++++++----- source/text.h | 18 +++++++++--------- source/texture.cpp | 7 +++---- source/texture.h | 2 +- source/tiled_bg.cpp | 13 +++++++------ source/title.cpp | 36 ++++++++++++++++++++---------------- source/title.h | 32 +++++++++++++------------------- source/utils.cpp | 13 ++++++------- source/utils.h | 29 +++++++++++++---------------- source/writer.cpp | 1 + source/writer.h | 6 +++--- 28 files changed, 229 insertions(+), 239 deletions(-) diff --git a/source/hiscore_table.h b/source/hiscore_table.h index a569d66..b80358d 100644 --- a/source/hiscore_table.h +++ b/source/hiscore_table.h @@ -2,16 +2,14 @@ #include // for SDL_Rect #include // for SDL_Renderer, SDL_Texture -#include // for Uint16, Uint32 +#include // for Uint16, Uint32, Uint8 #include // for unique_ptr #include // for string -class Background; -class Fade; -class Text; -enum class FadeMode : Uint8; -struct JA_Music_t; // lines 14-14 - -struct JA_Music_t; +class Background; // lines 8-8 +class Fade; // lines 9-9 +class Text; // lines 10-10 +enum class FadeMode : Uint8; // lines 11-11 +struct JA_Music_t; // lines 12-12 /* Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones diff --git a/source/instructions.cpp b/source/instructions.cpp index dfc8ba7..1ee5ef2 100644 --- a/source/instructions.cpp +++ b/source/instructions.cpp @@ -1,25 +1,26 @@ #include "instructions.h" #include // for SDL_BLENDMODE_BLEND +#include // for SDL_PollEvent, SDL_Event, SDL_QUIT #include // for SDL_PIXELFORMAT_RGBA8888 #include // for SDL_GetTicks #include // for SDL_WINDOWEVENT_SIZE_CHANGED #include // for max -#include // for basic_string +#include // for move #include "asset.h" // for Asset -#include "fade.h" // for Fade, FadeType::FULLSCREEN, FadeMode::IN -#include "global_inputs.h" // for globalInputs::check +#include "fade.h" // for Fade, FadeMode, FadeType +#include "global_inputs.h" // for check #include "input.h" // for Input #include "jail_audio.h" // for JA_GetMusicState, JA_Music_state #include "lang.h" // for getText #include "param.h" // for param #include "screen.h" // for Screen -#include "section.h" // for name, SectionName, options, SectionOptions +#include "section.h" // for Name, name, Options, options #include "sprite.h" // for Sprite -#include "text.h" // for Text, TEXT_CENTER, TEXT_COLOR, TEXT_SHADOW +#include "text.h" // for Text, TEXT_CENTER, TEXT_COLOR, TEXT_... #include "texture.h" // for Texture #include "tiled_bg.h" // for Tiledbg, TILED_MODE_STATIC -#include "utils.h" // for Param, ParamGame, Color, shdwT... -struct JA_Music_t; +#include "utils.h" // for Param, ParamGame, Color, shdw_txt_color +struct JA_Music_t; // lines 22-22 // Constructor Instructions::Instructions(JA_Music_t *music) diff --git a/source/instructions.h b/source/instructions.h index e8c6a71..3b543db 100644 --- a/source/instructions.h +++ b/source/instructions.h @@ -1,17 +1,16 @@ #pragma once -#include // for SDL_Event -#include // for SDL_Point, SDL_Rect -#include // for SDL_Texture, SDL_Renderer -#include // for Uint32 -#include // for vector -#include -#include "fade.h" -#include "sprite.h" -#include "text.h" -#include "texture.h" -#include "tiled_bg.h" -struct JA_Music_t; +#include // for SDL_Point, SDL_Rect +#include // for SDL_Texture, SDL_Renderer +#include // for Uint32 +#include // for unique_ptr, shared_ptr +#include // for vector +class Fade; +class Sprite; +class Text; +class Texture; +class Tiledbg; +struct JA_Music_t; // lines 14-14 /* Esta clase gestiona un estado del programa. Se encarga de poner en pantalla diff --git a/source/intro.cpp b/source/intro.cpp index f35f784..52f553e 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -1,22 +1,22 @@ #include "intro.h" -#include // for SDL_Renderer -#include // for SDL_GetTicks -#include // for SDL_WINDOWEVENT_SIZE_CHANGED -#include // for basic_string -#include "asset.h" // for Asset -#include "global_inputs.h" // for globalInputs::check -#include "input.h" // for Input -#include "jail_audio.h" // for JA_StopMusic, JA_PlayMusic -#include "lang.h" // for getText -#include "param.h" // for param -#include "screen.h" // for Screen -#include "section.h" // for name, SectionName, options, SectionOptions -#include "smart_sprite.h" // for SmartSprite -#include "text.h" // for Text -#include "texture.h" // for Texture -#include "utils.h" // for ParamGame, Param, Zone, BLOCK -#include "writer.h" // for Writer -struct JA_Music_t; +#include // for SDL_PollEvent, SDL_Event, SDL_QUIT, SDL... +#include // for SDL_GetTicks +#include // for SDL_WINDOWEVENT_SIZE_CHANGED +#include // for move +#include "asset.h" // for Asset +#include "global_inputs.h" // for check +#include "input.h" // for Input +#include "jail_audio.h" // for JA_StopMusic, JA_PlayMusic +#include "lang.h" // for getText +#include "param.h" // for param +#include "screen.h" // for Screen +#include "section.h" // for Name, name, Options, options +#include "smart_sprite.h" // for SmartSprite +#include "text.h" // for Text +#include "texture.h" // for Texture +#include "utils.h" // for Param, ParamGame, Zone, BLOCK, Color +#include "writer.h" // for Writer +struct JA_Music_t; // lines 19-19 // Constructor Intro::Intro(JA_Music_t *music) diff --git a/source/intro.h b/source/intro.h index 2c2bf5f..f61e85c 100644 --- a/source/intro.h +++ b/source/intro.h @@ -1,14 +1,13 @@ #pragma once -#include // for SDL_Event -#include // for Uint32, Uint8 -#include // for vector -#include -#include "smart_sprite.h" -#include "texture.h" -#include "text.h" -#include "writer.h" -struct JA_Music_t; +#include // for Uint32, Uint8 +#include // for unique_ptr, shared_ptr +#include // for vector +#include "smart_sprite.h" // for SmartSprite +#include "writer.h" // for Writer +class Text; +class Texture; +struct JA_Music_t; // lines 11-11 /* Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia diff --git a/source/item.h b/source/item.h index 1ec2a1a..d8b461e 100644 --- a/source/item.h +++ b/source/item.h @@ -1,13 +1,13 @@ #pragma once -#include // for SDL_Rect -#include // for Uint16 -#include // for string -#include // for vector -#include -#include "utils.h" // for Circle -#include "animated_sprite.h" -#include "texture.h" +#include // for SDL_Rect +#include // for Uint16 +#include // for shared_ptr, unique_ptr +#include // for string +#include // for vector +#include "animated_sprite.h" // for AnimatedSprite +#include "utils.h" // for Circle +class Texture; // Tipos de objetos constexpr int ITEM_POINTS_1_DISK = 1; diff --git a/source/logo.cpp b/source/logo.cpp index 4c24398..810bc08 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -1,17 +1,18 @@ #include "logo.h" -#include // for SDL_Renderer -#include // for SDL_GetTicks -#include // for SDL_WINDOWEVENT_SIZE_CHANGED -#include // for basic_string -#include "asset.h" // for Asset -#include "global_inputs.h" // for globalInputs::check -#include "input.h" // for Input -#include "jail_audio.h" // for JA_StopMusic -#include "param.h" // for param -#include "screen.h" // for Screen -#include "section.h" // for name, SectionName, options, SectionOptions -#include "sprite.h" // for Sprite -#include "texture.h" // for Texture +#include // for SDL_PollEvent, SDL_Event, SDL_QUIT, SDL... +#include // for SDL_Renderer +#include // for SDL_GetTicks +#include // for SDL_WINDOWEVENT_SIZE_CHANGED +#include // for move +#include "asset.h" // for Asset +#include "global_inputs.h" // for check +#include "input.h" // for Input +#include "jail_audio.h" // for JA_StopMusic +#include "param.h" // for param +#include "screen.h" // for Screen +#include "section.h" // for Name, name, Options, options +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture // Constructor Logo::Logo() diff --git a/source/logo.h b/source/logo.h index e3d872d..6efe103 100644 --- a/source/logo.h +++ b/source/logo.h @@ -1,13 +1,12 @@ #pragma once -#include // for SDL_Event -#include // for SDL_Point -#include // for Uint32 -#include // for vector -#include -#include "utils.h" // for Color -#include "sprite.h" -#include "texture.h" +#include // for SDL_Point +#include // for Uint32 +#include // for unique_ptr, shared_ptr +#include // for vector +#include "sprite.h" // for Sprite +#include "utils.h" // for Color +class Texture; /* Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el diff --git a/source/main.cpp b/source/main.cpp index 137b7e0..759fe3e 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -7,10 +7,9 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024 */ -#include // for basic_ostream, char_traits, operator<<, cout -#include // for basic_string, operator<<, string -#include -#include "director.h" // for Director +#include // for char_traits, basic_ostream, operator<<, cout +#include // for make_unique, unique_ptr +#include "director.h" // for Director int main(int argc, char *argv[]) { diff --git a/source/moving_sprite.h b/source/moving_sprite.h index 6c501f2..f8e32d6 100644 --- a/source/moving_sprite.h +++ b/source/moving_sprite.h @@ -1,11 +1,11 @@ #pragma once -#include // for SDL_Rect, SDL_Point -#include // for SDL_RendererFlip -#include // for Uint16 -#include -#include "sprite.h" // for Sprite -#include "texture.h" +#include // for SDL_Rect, SDL_Point +#include // for SDL_RendererFlip +#include // for Uint16 +#include // for shared_ptr +#include "sprite.h" // for Sprite +class Texture; // Clase MovingSprite. Añade posicion y velocidad en punto flotante class MovingSprite : public Sprite diff --git a/source/notify.cpp b/source/notify.cpp index f68d51b..ccb5322 100644 --- a/source/notify.cpp +++ b/source/notify.cpp @@ -1,13 +1,12 @@ #include "notify.h" -#include // for SDL_BLENDMODE_BLEND -#include // for SDL_PIXELFORMAT_RGBA8888 -#include // for basic_string, char_traits, string -#include "jail_audio.h" // for JA_DeleteSound, JA_LoadSound, JA_Pla... -#include "options.h" // for options -#include "param.h" -#include "sprite.h" // for Sprite -#include "text.h" // for Text -#include "texture.h" // for Texture +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for string +#include "jail_audio.h" // for JA_DeleteSound, JA_LoadSound, JA_Pla... +#include "param.h" // for param +#include "sprite.h" // for Sprite +#include "text.h" // for Text +#include "texture.h" // for Texture // Constructor Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, const std::string &soundFile) diff --git a/source/notify.h b/source/notify.h index 89ab780..f56e2b1 100644 --- a/source/notify.h +++ b/source/notify.h @@ -1,15 +1,15 @@ #pragma once -#include // for SDL_Rect -#include // for SDL_Renderer -#include // for basic_string, string -#include // for vector -#include -#include "utils.h" // for Color -#include "text.h" -#include "texture.h" -#include "sprite.h" -struct JA_Sound_t; +#include // for SDL_Rect +#include // for SDL_Renderer +#include // for shared_ptr, unique_ptr +#include // for string, basic_string +#include // for vector +#include "utils.h" // for Color +class Sprite; +class Text; +class Texture; +struct JA_Sound_t; // lines 12-12 class Notify { diff --git a/source/on_screen_help.cpp b/source/on_screen_help.cpp index c1b788d..fdde3ea 100644 --- a/source/on_screen_help.cpp +++ b/source/on_screen_help.cpp @@ -1,16 +1,15 @@ #include "on_screen_help.h" -#include // for SDL_BLENDMODE_BLEND -#include // for SDL_PIXELFORMAT_RGBA8888 -#include // for make_unique, unique_ptr -#include // for basic_string -#include "asset.h" // for Asset -#include "lang.h" // for getText -#include "param.h" // for param -#include "screen.h" // for Screen -#include "sprite.h" // for Sprite -#include "text.h" // for Text -#include "texture.h" // for Texture -#include "utils.h" // for easeInOutSine, ParamGame, Param +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for make_unique, make_shared, unique_ptr +#include "asset.h" // for Asset +#include "lang.h" // for getText +#include "param.h" // for param +#include "screen.h" // for Screen +#include "sprite.h" // for Sprite +#include "text.h" // for Text +#include "texture.h" // for Texture +#include "utils.h" // for easeInOutSine, Param, ParamGame // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado OnScreenHelp *OnScreenHelp::onScreenHelp = nullptr; diff --git a/source/on_screen_help.h b/source/on_screen_help.h index c1135ec..90b5a3e 100644 --- a/source/on_screen_help.h +++ b/source/on_screen_help.h @@ -1,11 +1,10 @@ #pragma once -#include // for SDL_Rect -#include // for SDL_Texture -#include // for vector -#include -#include "sprite.h" // lines 10-10 -#include "text.h" +#include // for SDL_Rect +#include // for SDL_Texture +#include // for vector +class Sprite; +class Text; enum class OnScreenHelpStatus { diff --git a/source/player.h b/source/player.h index 8047556..fc28b1f 100644 --- a/source/player.h +++ b/source/player.h @@ -1,15 +1,16 @@ #pragma once -#include // for SDL_Rect -#include // for Uint32 -#include // for unique_ptr -#include // for string, basic_string -#include // for vector -#include "animated_sprite.h" // for AnimatedSprite -#include "enter_name.h" // for EnterName -#include "utils.h" // for Circle -#include "texture.h" // lines 12-12 -enum class ScoreboardMode; +#include // for SDL_Rect +#include // for Uint32 +#include // for unique_ptr, shared_ptr +#include // for string +#include // for vector +#include "animated_sprite.h" // for AnimatedSprite +#include "enter_name.h" // for EnterName +#include "utils.h" // for Circle +class Texture; +enum class InputType : int; +enum class ScoreboardMode; // lines 12-12 // Estados del jugador enum class PlayerStatus diff --git a/source/scoreboard.h b/source/scoreboard.h index f4c948d..fd6560f 100644 --- a/source/scoreboard.h +++ b/source/scoreboard.h @@ -1,15 +1,15 @@ #pragma once -#include // for SDL_Point, SDL_Rect -#include // for SDL_Renderer, SDL_Texture -#include // for Uint32 -#include // for unique_ptr -#include // for string, basic_string -#include // for vector -#include "utils.h" // for Color -#include "sprite.h" // lines 11-11 -#include "text.h" // lines 12-12 -#include "texture.h" // lines 13-13 +#include // for SDL_Point, SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for Uint32 +#include // for unique_ptr, shared_ptr +#include // for string +#include // for vector +#include "utils.h" // for Color +class Sprite; +class Text; +class Texture; // Defines constexpr int SCOREBOARD_LEFT_PANEL = 0; diff --git a/source/smart_sprite.h b/source/smart_sprite.h index 07b3ea4..a16669c 100644 --- a/source/smart_sprite.h +++ b/source/smart_sprite.h @@ -1,8 +1,8 @@ #pragma once -#include "animated_sprite.h" // for AnimatedSprite -#include "texture.h" -#include +#include // for shared_ptr +#include "animated_sprite.h" // for AnimatedSprite +class Texture; // Clase SmartSprite class SmartSprite : public AnimatedSprite diff --git a/source/text.cpp b/source/text.cpp index de36ea8..55e9e32 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -1,9 +1,10 @@ #include "text.h" -#include // for char_traits, basic_ostream, basic_ifstream, ope... -#include // for cout -#include "sprite.h" // for Sprite -#include "texture.h" // for Texture -#include "utils.h" // for Color +#include // for SDL_Rect +#include // for basic_ostream, basic_ifstream, basic_istream +#include // for cout +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture +#include "utils.h" // for Color // Llena una estructuta TextFile desde un fichero TextFile LoadTextFile(std::string file_path) diff --git a/source/text.h b/source/text.h index d87cf74..2ffd385 100644 --- a/source/text.h +++ b/source/text.h @@ -2,11 +2,11 @@ #include // for SDL_Renderer #include // for Uint8 +#include // for shared_ptr, unique_ptr #include // for string -#include -#include "utils.h" -#include "sprite.h" -#include "texture.h" +#include "sprite.h" // for Sprite +#include "utils.h" // for Color +class Texture; constexpr int TEXT_COLOR = 1; constexpr int TEXT_SHADOW = 2; @@ -33,13 +33,13 @@ class Text { private: // Objetos y punteros - std::unique_ptr sprite_; // Objeto con los graficos para el texto + std::unique_ptr sprite_; // Objeto con los graficos para el texto std::shared_ptr texture_; // Textura con los bitmaps del texto // Variables - int box_width_; // Anchura de la caja de cada caracter en el png - int box_height_; // Altura de la caja de cada caracter en el png - bool fixed_width_; // Indica si el texto se ha de escribir con longitud fija en todas las letras + int box_width_; // Anchura de la caja de cada caracter en el png + int box_height_; // Altura de la caja de cada caracter en el png + bool fixed_width_; // Indica si el texto se ha de escribir con longitud fija en todas las letras TextOffset offset_[128]; // Vector con las posiciones y ancho de cada letra public: @@ -64,7 +64,7 @@ public: void writeCentered(int x, int y, const std::string &text, int kerning = 1, int lenght = -1); // Escribe texto con extras - void writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning = 1, Color textColor = {255, 255, 255}, Uint8 shadow_distance = 1, Color shadow_color = {0, 0, 0}, int lenght = -1); + void writeDX(Uint8 flags, int x, int y, const std::string &text, int kerning = 1, Color textColor = Color(), Uint8 shadow_distance = 1, Color shadow_color = Color(), int lenght = -1); // Obtiene la longitud en pixels de una cadena int lenght(const std::string &text, int kerning = 1) const; diff --git a/source/texture.cpp b/source/texture.cpp index 50b941e..6344a18 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -62,7 +62,6 @@ bool Texture::loadFromFile(const std::string &path) if (!data) { #ifdef VERBOSE - const std::string file_name = path.substr(path.find_last_of("\\/") + 1); std::cout << "Loading image failed: " << stbi_failure_reason() << std::endl; #endif exit(1); @@ -240,14 +239,14 @@ SDL_Texture *Texture::getSDLTexture() } // Crea una nueva surface -Surface Texture::newSurface(int w, int h) +/*Surface Texture::newSurface(int w, int h) { Surface surf = static_cast(malloc(sizeof(surface_s))); surf->w = w; surf->h = h; surf->data = static_cast(malloc(w * h)); return surf; -} +}*/ // Elimina una surface void Texture::deleteSurface(Surface surface) @@ -345,7 +344,7 @@ std::vector Texture::loadPal(const std::string &file_name) fread(buffer, size, 1, f); fclose(f); - const auto pal = LoadPalette(buffer); + const auto *pal = LoadPalette(buffer); if (!pal) { return palette; diff --git a/source/texture.h b/source/texture.h index 990294e..03e5b5d 100644 --- a/source/texture.h +++ b/source/texture.h @@ -33,7 +33,7 @@ private: int paletteIndex_; // Indice de la paleta en uso // Crea una nueva surface - Surface newSurface(int w, int h); + //Surface newSurface(int w, int h); // Elimina una surface void deleteSurface(Surface surface); diff --git a/source/tiled_bg.cpp b/source/tiled_bg.cpp index d37ae9a..cc733db 100644 --- a/source/tiled_bg.cpp +++ b/source/tiled_bg.cpp @@ -1,10 +1,11 @@ #include "tiled_bg.h" -#include // for SDL_PIXELFORMAT_RGBA8888 -#include // for SDL_sinf -#include // for rand -#include "screen.h" // for Screen -#include "sprite.h" // for Sprite -#include "texture.h" // for Texture +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_sinf +#include // for rand +#include // for unique_ptr, make_shared, make_unique +#include "screen.h" // for Screen +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture // Constructor Tiledbg::Tiledbg(std::string texture_path, SDL_Rect pos, int mode) diff --git a/source/title.cpp b/source/title.cpp index 3ddc578..2d33553 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -1,20 +1,24 @@ #include "title.h" -#include // for SDLK_1, SDLK_2, SDLK_3 -#include // for SDL_Renderer -#include // for SDL_GetTicks -#include // for allocator, basic_string, char_traits -#include // for vector -#include "asset.h" // for Asset -#include "global_inputs.h" // for globalInputs::check -#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_RE... -#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_P... -#include "lang.h" // for getText -#include "options.h" // for options -#include "param.h" // for param -#include "screen.h" // for Screen -#include "section.h" // for SectionOptions, options, SectionName, name - -struct JA_Music_t; +#include // for SDL_PollEvent, SDL_Event, SDL_KEYDOWN +#include // for SDLK_1, SDLK_2, SDLK_3 +#include // for SDL_Rect +#include // for SDL_Renderer +#include // for SDL_GetTicks +#include // for char_traits, operator+, to_string, bas... +#include // for move +#include // for vector +#include "asset.h" // for Asset +#include "global_inputs.h" // for check +#include "input.h" // for Input, InputType, INPUT_DO_NOT_ALLOW_R... +#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state, JA_P... +#include "lang.h" // for getText +#include "options.h" // for options +#include "param.h" // for param +#include "screen.h" // for Screen +#include "section.h" // for Options, options, Name, name +#include "texture.h" // for Texture +#include "utils.h" // for Param, OptionsController, Color, Param... +struct JA_Music_t; // lines 17-17 // Constructor Title::Title(JA_Music_t *music) diff --git a/source/title.h b/source/title.h index 9a56482..8e820d8 100644 --- a/source/title.h +++ b/source/title.h @@ -1,24 +1,18 @@ #pragma once -#include // for SDL_Event -#include // for Uint32 -#include -#include "define_buttons.h" -#include "fade.h" -#include "game_logo.h" -#include "text.h" -#include "tiled_bg.h" -#include "utils.h" // for Section -#include "sprite.h" -#include "texture.h" -#include "section.h" - -class Asset; -class Input; -class Screen; -class Sprite; -class Texture; -struct JA_Music_t; +#include // for Uint32 +#include // for unique_ptr, shared_ptr +#include "define_buttons.h" // for DefineButtons +#include "fade.h" // for Fade +#include "game_logo.h" // for GameLogo +#include "sprite.h" // for Sprite +#include "text.h" // for Text +#include "tiled_bg.h" // for Tiledbg +class Input; // lines 17-17 +class Screen; // lines 18-18 +class Texture; // lines 20-20 +namespace section { enum class Name; } +struct JA_Music_t; // lines 21-21 // Textos constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner"; diff --git a/source/utils.cpp b/source/utils.cpp index 01394ab..ac29902 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,11 +1,10 @@ #include "utils.h" -#include // for free, malloc -#include // for max, min -#include // for isspace -#include // for distance -#include -struct JA_Music_t; // lines 3-3 -struct JA_Sound_t; // lines 4-4 +#include // for min, clamp, find_if_not, transform +#include // for tolower, isspace +#include // for cos, pow, M_PI +#include // for operator< +struct JA_Music_t; // lines 7-7 +struct JA_Sound_t; // lines 8-8 // Colores const Color bg_color = {0x27, 0x27, 0x36}; diff --git a/source/utils.h b/source/utils.h index c40143d..cff6d95 100644 --- a/source/utils.h +++ b/source/utils.h @@ -3,16 +3,19 @@ #include // for SDL_GameControllerButton #include // for SDL_Rect, SDL_Point #include // for SDL_Renderer -#include // for Uint8, Uint32 +#include // for Uint8 #include // for int32_t -#include // for string, basic_string +#include // for string #include // for vector -#include "input.h" // for inputs_e -#include "lang.h" -struct JA_Music_t; -struct JA_Sound_t; -enum class ScreenFilter; -enum class ScreenVideoMode; +enum class InputType : int; +enum class ScreenFilter; // lines 14-14 +enum class ScreenVideoMode; // lines 15-15 +namespace lang +{ + enum class Code : int; +} +struct JA_Music_t; // lines 12-12 +struct JA_Sound_t; // lines 13-13 // Dificultad del juego enum class GameDifficulty @@ -35,6 +38,7 @@ struct Circle struct Color { Uint8 r, g, b; + constexpr Color(int red = 255, int green = 255, int blue = 255) : r(red), g(green), b(blue) {} }; // Posiciones de las notificaciones @@ -47,13 +51,6 @@ enum class NotifyPosition RIGHT, }; -// Estructura para saber la seccion y subseccion del programa -/*struct Section -{ - section::Name name; - section::Options options; -};*/ - // Estructura para las entradas de la tabla de recirds struct HiScoreEntry { @@ -114,7 +111,7 @@ struct OptionsAudio struct OptionsGame { GameDifficulty difficulty; // Dificultad del juego - lang::Code language; // Idioma usado en el juego + lang::Code language; // Idioma usado en el juego bool autofire; // Indica si el jugador ha de pulsar repetidamente para disparar o basta con mantener pulsado std::vector hi_score_table; // Tabla con las mejores puntuaciones }; diff --git a/source/writer.cpp b/source/writer.cpp index c798b74..b1a73f5 100644 --- a/source/writer.cpp +++ b/source/writer.cpp @@ -1,4 +1,5 @@ #include "writer.h" +#include "text.h" // for Text // Constructor Writer::Writer(std::shared_ptr text) diff --git a/source/writer.h b/source/writer.h index 5f4e556..fd40c03 100644 --- a/source/writer.h +++ b/source/writer.h @@ -1,8 +1,8 @@ #pragma once -#include // for string, basic_string -#include -#include "text.h" +#include // for shared_ptr +#include // for string +class Text; // Clase Writer. Pinta texto en pantalla letra a letra a partir de una cadena y un objeto Text class Writer