diff --git a/go.sh b/go.sh new file mode 100755 index 0000000..871de68 --- /dev/null +++ b/go.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +SECONDS=0 +make linux_debug +duration=$SECONDS +echo "$((duration / 60)) minutes and $((duration % 60)) seconds elapsed." diff --git a/source/animatedsprite.cpp b/source/animated_sprite.cpp similarity index 98% rename from source/animatedsprite.cpp rename to source/animated_sprite.cpp index e776826..0e0d997 100644 --- a/source/animatedsprite.cpp +++ b/source/animated_sprite.cpp @@ -1,7 +1,8 @@ -#include "animatedsprite.h" -#include -#include -#include +#include "animated_sprite.h" +#include // for basic_ostream, operator<<, basic_istream, basic... +#include // for cout +#include // for basic_stringstream +#include "texture.h" // for Texture // Carga la animación desde un fichero animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath, bool verbose) diff --git a/source/animatedsprite.h b/source/animated_sprite.h similarity index 92% rename from source/animatedsprite.h rename to source/animated_sprite.h index 1f37ba1..f98b7bd 100644 --- a/source/animatedsprite.h +++ b/source/animated_sprite.h @@ -1,9 +1,11 @@ #pragma once -#include -#include "movingsprite.h" -#include -#include +#include // for SDL_Rect +#include // for Uint8 +#include // for string, basic_string +#include // for vector +#include "moving_sprite.h" // for MovingSprite +class Texture; struct animation_t { diff --git a/source/asset.cpp b/source/asset.cpp index 530ee47..de3d60a 100644 --- a/source/asset.cpp +++ b/source/asset.cpp @@ -1,5 +1,8 @@ #include "asset.h" -#include +#include // for SDL_RWFromFile, SDL_RWclose, SDL_RWops +#include // for SDL_max +#include // for size_t +#include // for basic_ostream, operator<<, cout, endl // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado Asset *Asset::asset = nullptr; diff --git a/source/asset.h b/source/asset.h index d2d0b89..bc2e2e1 100644 --- a/source/asset.h +++ b/source/asset.h @@ -1,8 +1,7 @@ #pragma once -#include -#include -#include +#include // for string, basic_string +#include // for vector enum assetType { diff --git a/source/background.cpp b/source/background.cpp index 949b7f7..32a7a28 100644 --- a/source/background.cpp +++ b/source/background.cpp @@ -1,5 +1,13 @@ #include "background.h" -#include "param.h" +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for max, min +#include // for basic_string +#include "asset.h" // for Asset +#include "moving_sprite.h" // for MovingSprite +#include "param.h" // for param +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture // Constructor Background::Background(SDL_Renderer *renderer) diff --git a/source/background.h b/source/background.h index f926733..c1cf402 100644 --- a/source/background.h +++ b/source/background.h @@ -1,9 +1,12 @@ #pragma once -#include -#include "asset.h" -#include "movingsprite.h" -#include "utils.h" +#include // for SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include "utils.h" // for color_t +class Asset; +class MovingSprite; +class Sprite; +class Texture; /* Esta clase es la encargada de dibujar el fondo que aparece durante la sección diff --git a/source/balloon.cpp b/source/balloon.cpp index de9b904..4a68491 100644 --- a/source/balloon.cpp +++ b/source/balloon.cpp @@ -1,5 +1,11 @@ #include "balloon.h" -#include "param.h" +#include // for abs +#include // for abs +#include "animated_sprite.h" // for AnimatedSprite +#include "moving_sprite.h" // for MovingSprite +#include "param.h" // for param +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture // Constructor Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, Texture *texture, std::vector *animation) diff --git a/source/balloon.h b/source/balloon.h index d2b3a28..a81ab6a 100644 --- a/source/balloon.h +++ b/source/balloon.h @@ -1,10 +1,11 @@ #pragma once -#include -#include "animatedsprite.h" -#include "utils.h" -#include -#include +#include // for Uint8, Uint16, Uint32 +#include // for string +#include // for vector +#include "utils.h" // for circle_t +class AnimatedSprite; +class Texture; // Cantidad de elementos del vector con los valores de la deformación del globo al rebotar #define MAX_BOUNCE 10 diff --git a/source/bullet.cpp b/source/bullet.cpp index 98411de..3f62c9a 100644 --- a/source/bullet.cpp +++ b/source/bullet.cpp @@ -1,5 +1,7 @@ #include "bullet.h" -#include "param.h" +#include "param.h" // for param +#include "sprite.h" // for Sprite +class Texture; // Constructor Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture) diff --git a/source/bullet.h b/source/bullet.h index 267dd62..c1722bf 100644 --- a/source/bullet.h +++ b/source/bullet.h @@ -1,8 +1,10 @@ #pragma once -#include -#include "sprite.h" -#include "utils.h" +#include // for SDL_Rect +#include // for Uint8 +#include "utils.h" // for circle_t +class Sprite; +class Texture; // Tipos de bala #define BULLET_UP 1 diff --git a/source/dbhtxt.cpp b/source/dbgtxt.cpp similarity index 94% rename from source/dbhtxt.cpp rename to source/dbgtxt.cpp index 1a9319c..c654dcc 100644 --- a/source/dbhtxt.cpp +++ b/source/dbgtxt.cpp @@ -1,9 +1,12 @@ #include "dbgtxt.h" +#include // for SDL_Rect +#include // for SDL_RWFromMem +#include // for SDL_LoadBMP_RW namespace { - SDL_Texture *dbg_tex = NULL; - SDL_Renderer *dbg_ren = NULL; + SDL_Texture *dbg_tex = nullptr; + SDL_Renderer *dbg_ren = nullptr; } void dbg_init(SDL_Renderer *renderer) diff --git a/source/dbgtxt.h b/source/dbgtxt.h index e4444ae..b44f31d 100644 --- a/source/dbgtxt.h +++ b/source/dbgtxt.h @@ -1,6 +1,7 @@ #pragma once -#include +#include // for SDL_Renderer +#include // for Uint8 void dbg_init(SDL_Renderer *renderer); void dbg_print(int x, int y, const char *text, Uint8 r, Uint8 g, Uint8 b); diff --git a/source/define_buttons.cpp b/source/define_buttons.cpp index 35eb09a..1a85975 100644 --- a/source/define_buttons.cpp +++ b/source/define_buttons.cpp @@ -1,7 +1,10 @@ #include "define_buttons.h" -#include "param.h" -#include "options.h" -#include "section.h" +#include "lang.h" // for getText +#include "options.h" // for options +#include "param.h" // for param +#include "section.h" // for name, name_e, options, options_e +#include "text.h" // for Text +#include "utils.h" // for op_controller_t, options_t, param_t, paramGame_t // Constructor DefineButtons::DefineButtons(Text *text) diff --git a/source/define_buttons.h b/source/define_buttons.h index d34f59e..c02999e 100644 --- a/source/define_buttons.h +++ b/source/define_buttons.h @@ -1,9 +1,11 @@ #pragma once -#include -#include "input.h" -#include "text.h" -#include "lang.h" +#include // for SDL_ControllerButtonEvent +#include // for SDL_GameControllerButton +#include // for string, basic_string +#include // for vector +#include "input.h" // for inputs_e +class Text; struct db_button_t { diff --git a/source/director.cpp b/source/director.cpp index ab890e8..4a8fb84 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -1,17 +1,38 @@ #include "director.h" -#include "utils.h" -#include "options.h" -#include "section.h" -#include -#include -#include -#include -#include -#include "dbgtxt.h" - -#ifndef _WIN32 -#include -#endif +#include // for SDL_Init, SDL_Quit, SDL_INIT_EV... +#include // for AUDIO_S16 +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_GetError +#include // for SDL_CONTROLLER_BUTTON_B, SDL_CO... +#include // for SDL_SetHint, SDL_HINT_RENDER_DR... +#include // for SDL_SCANCODE_DOWN, SDL_SCANCODE_E +#include // for Uint32 +#include // for SDL_GetTicks +#include // for errno, EACCES, EEXIST, ENAMETOO... +#include // for getpwuid, passwd +#include // for printf, perror, size_t +#include // for strcmp +#include // for stat, mkdir, S_IRWXU +#include // for getuid +#include // for exit, EXIT_FAILURE, rand, srand +#include // for basic_ostream, operator<<, cout +#include // for basic_string, operator+, allocator +#include "asset.h" // for Asset, assetType +#include "dbgtxt.h" // for dbg_init +#include "game.h" // for Game, GAME_MODE_DEMO_OFF, GAME_... +#include "hiscore_table.h" // for HiScoreTable +#include "input.h" // for inputs_e, Input +#include "instructions.h" // for Instructions +#include "intro.h" // for Intro +#include "jail_audio.h" // for JA_DeleteMusic, JA_DeleteSound +#include "logo.h" // for Logo +#include "manage_hiscore_table.h" // for ManageHiScoreTable +#include "options.h" // for options, loadOptionsFile, saveO... +#include "param.h" // for param, loadParamsFromFile +#include "screen.h" // for Screen +#include "section.h" // for name_e, name, options, options_e +#include "title.h" // for Title +#include "utils.h" // for music_file_t, sound_file_t, opt... // Constructor Director::Director(int argc, char *argv[]) diff --git a/source/director.h b/source/director.h index 25fb694..2322d1a 100644 --- a/source/director.h +++ b/source/director.h @@ -1,22 +1,20 @@ #pragma once -#include -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "screen.h" -#include "text.h" -#include "utils.h" -#include "fade.h" -#include "game.h" -#include "intro.h" -#include "item.h" -#include "lang.h" -#include "logo.h" -#include "player.h" -#include "title.h" -#include "param.h" -#include "manage_hiscore_table.h" +#include // for SDL_Renderer +#include // for SDL_Window +#include // for string, basic_string +#include // for vector +#include "lang.h" // for lang_e +#include "utils.h" // for music_file_t, sound_file_t +class Asset; +class Game; +class HiScoreTable; +class Input; +class Instructions; +class Intro; +class Logo; +class Screen; +class Title; // Textos #define WINDOW_CAPTION "Coffee Crisis Arcade Edition" diff --git a/source/enemy_formations.cpp b/source/enemy_formations.cpp index 21e7645..052f104 100644 --- a/source/enemy_formations.cpp +++ b/source/enemy_formations.cpp @@ -1,5 +1,7 @@ #include "enemy_formations.h" -#include "param.h" +#include "balloon.h" // for BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE +#include "param.h" // for param +#include "utils.h" // for paramGame_t, param_t, zone_t, BLOCK // Constructor EnemyFormations::EnemyFormations() diff --git a/source/enemy_formations.h b/source/enemy_formations.h index aa40c9e..bbbff60 100644 --- a/source/enemy_formations.h +++ b/source/enemy_formations.h @@ -1,9 +1,5 @@ #pragma once -#include -#include "utils.h" -#include "balloon.h" - #define NUMBER_OF_ENEMY_FORMATIONS 100 #define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50 diff --git a/source/enter_name.cpp b/source/enter_name.cpp index 00b61de..ac38004 100644 --- a/source/enter_name.cpp +++ b/source/enter_name.cpp @@ -1,4 +1,5 @@ #include "enter_name.h" +#include // for max, min // Constructor EnterName::EnterName(std::string *name) diff --git a/source/explosions.cpp b/source/explosions.cpp index b319595..c70f826 100644 --- a/source/explosions.cpp +++ b/source/explosions.cpp @@ -1,4 +1,6 @@ #include "explosions.h" +#include "animated_sprite.h" // for AnimatedSprite +class Texture; // Constructor Explosions::Explosions() diff --git a/source/explosions.h b/source/explosions.h index 86e033d..ad843ff 100644 --- a/source/explosions.h +++ b/source/explosions.h @@ -1,9 +1,9 @@ #pragma once -#include -#include "texture.h" -#include "animatedsprite.h" -#include +#include // for string +#include // for vector +class AnimatedSprite; +class Texture; struct explosion_texture_t { diff --git a/source/fade.cpp b/source/fade.cpp index 3cab337..11f08f9 100644 --- a/source/fade.cpp +++ b/source/fade.cpp @@ -1,6 +1,10 @@ #include "fade.h" -#include "param.h" -#include +#include // for SDL_BLENDMODE_BLEND, SDL_BLENDMODE_NONE +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for rand +#include // for min, max +#include "param.h" // for param +#include "utils.h" // for param_t, paramGame_t, paramFade_t // Constructor Fade::Fade(SDL_Renderer *renderer) diff --git a/source/fade.h b/source/fade.h index f7782a8..ade0a02 100644 --- a/source/fade.h +++ b/source/fade.h @@ -1,8 +1,9 @@ #pragma once -#include -#include "texture.h" -#include "utils.h" +#include // for SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for Uint8, Uint16 +#include // for vector // Tipos de fundido #define FADE_FULLSCREEN 0 diff --git a/source/game.cpp b/source/game.cpp index f56c1ac..fe4dbce 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -1,7 +1,36 @@ #include "game.h" -#include "param.h" -#include "options.h" -#include +#include // for SDL_BLENDMODE_BLEND +#include // for SDLK_1, SDLK_2, SDLK_3, SDLK_h +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_RWFromFile, SDL_RWclose, SDL_R... +#include // for SDL_GetTicks +#include // for SDL_WINDOWEVENT_FOCUS_GAINED, SDL_... +#include // for rand +#include // for min +#include // for basic_ifstream +#include // for char_traits, basic_istream, ifstream +#include "asset.h" // for Asset +#include "background.h" // for Background +#include "balloon.h" // for Balloon, BALLOON_SPEED_1, BALLOON_... +#include "bullet.h" // for Bullet, BULLET_LEFT, BULLET_RIGHT +#include "enemy_formations.h" // for stage_t, EnemyFormations, enemyIni... +#include "explosions.h" // for Explosions +#include "fade.h" // for Fade, FADE_RANDOM_SQUARE, FADE_VEN... +#include "input.h" // for inputs_e, Input, INPUT_DO_NOT_ALLO... +#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK +#include "jail_audio.h" // for JA_PlaySound, JA_DeleteSound, JA_L... +#include "lang.h" // for getText +#include "manage_hiscore_table.h" // for ManageHiScoreTable +#include "options.h" // for options +#include "param.h" // for param +#include "player.h" // for Player, PLAYER_STATUS_PLAYING, PLA... +#include "scoreboard.h" // for Scoreboard, scoreboard_modes_e +#include "screen.h" // for Screen +#include "smart_sprite.h" // for SmartSprite +#include "text.h" // for Text, TXT_CENTER +#include "texture.h" // for Texture +struct JA_Music_t; +struct JA_Sound_t; #define GAME_OVER_COUNTER 350 diff --git a/source/game.h b/source/game.h index 9f19e62..e667614 100644 --- a/source/game.h +++ b/source/game.h @@ -1,28 +1,29 @@ #pragma once -#include -#include "balloon.h" -#include "bullet.h" -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "movingsprite.h" -#include "screen.h" -#include "smartsprite.h" -#include "sprite.h" -#include "text.h" -#include "utils.h" -#include "fade.h" -#include "item.h" -#include "player.h" -#include "scoreboard.h" -#include "background.h" -#include "lang.h" -#include "manage_hiscore_table.h" -#include "explosions.h" -#include "enemy_formations.h" -#include "section.h" -#include +#include // for SDL_Event +#include // for SDL_Renderer, SDL_Texture +#include // for Uint32 +#include // for string +#include // for vector +#include "section.h" // for options_e +#include "utils.h" // for demoKeys_t, color_t, hiScoreEntry_t +class Asset; +class Background; +class Balloon; +class Bullet; +class EnemyFormations; +class Explosions; +class Fade; +class Input; +class Item; +class Player; +class Scoreboard; +class Screen; +class SmartSprite; +class Text; +class Texture; +struct JA_Music_t; +struct JA_Sound_t; #define GAME_MODE_DEMO_OFF false #define GAME_MODE_DEMO_ON true diff --git a/source/game_logo.cpp b/source/game_logo.cpp index 12c5cca..fd6b8ec 100644 --- a/source/game_logo.cpp +++ b/source/game_logo.cpp @@ -1,5 +1,15 @@ #include "game_logo.h" -#include "param.h" +#include // for max +#include // for basic_string +#include "animated_sprite.h" // for AnimatedSprite +#include "asset.h" // for Asset +#include "jail_audio.h" // for JA_DeleteSound, JA_LoadSound, JA_PlaySound +#include "param.h" // for param +#include "screen.h" // for Screen +#include "smart_sprite.h" // for SmartSprite +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture +#include "utils.h" // for param_t, paramGame_t, paramTitle_t // Constructor GameLogo::GameLogo(int x, int y) diff --git a/source/game_logo.h b/source/game_logo.h index ac424c9..c67e744 100644 --- a/source/game_logo.h +++ b/source/game_logo.h @@ -1,10 +1,13 @@ #pragma once -#include -#include "asset.h" -#include "screen.h" -#include "smartsprite.h" -#include "jail_audio.h" +#include // for SDL_Renderer +class AnimatedSprite; +class Asset; +class Screen; +class SmartSprite; +class Sprite; +class Texture; +struct JA_Sound_t; // Clase GameLogo class GameLogo diff --git a/source/global_inputs.cpp b/source/global_inputs.cpp index 63fcbc5..2030340 100644 --- a/source/global_inputs.cpp +++ b/source/global_inputs.cpp @@ -1,9 +1,12 @@ #include "global_inputs.h" -#include "section.h" -#include "screen.h" -#include "input.h" -#include "lang.h" -#include "options.h" +#include // for basic_string, operator+ +#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT +#include "jail_audio.h" // for JA_EnableMusic, JA_EnableSound +#include "lang.h" // for getText +#include "options.h" // for options +#include "screen.h" // for Screen +#include "section.h" // for options_e, name, name_e, options +#include "utils.h" // for op_audio_t, options_t, op_music_t, boolToOnOff // Termina void quit(section::options_e code) diff --git a/source/hiscore_table.cpp b/source/hiscore_table.cpp index 0e05e52..69eebd2 100644 --- a/source/hiscore_table.cpp +++ b/source/hiscore_table.cpp @@ -1,8 +1,22 @@ -#include -#include "global_inputs.h" #include "hiscore_table.h" -#include "options.h" -#include "param.h" +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_GetTicks +#include // for SDL_WINDOWEVENT_SIZE_CHANGED +#include // for max +#include // for vector +#include "asset.h" // for Asset +#include "background.h" // for Background +#include "fade.h" // for Fade, FADE_IN, FADE_OUT, FADE_RANDOM... +#include "global_inputs.h" // for checkGlobalInputs +#include "input.h" // for Input +#include "jail_audio.h" // for JA_GetMusicState, JA_Music_state +#include "lang.h" // for getText +#include "options.h" // for options +#include "param.h" // for param +#include "screen.h" // for Screen +#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW, TXT_COLOR +#include "utils.h" // for param_t, paramGame_t, hiScoreEntry_t // Constructor HiScoreTable::HiScoreTable(JA_Music_t *music) diff --git a/source/hiscore_table.h b/source/hiscore_table.h index 317da82..0f28eb9 100644 --- a/source/hiscore_table.h +++ b/source/hiscore_table.h @@ -1,17 +1,18 @@ #pragma once -#include -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "screen.h" -#include "sprite.h" -#include "text.h" -#include "utils.h" -#include "lang.h" -#include "fade.h" -#include "background.h" -#include "section.h" +#include // for SDL_Event +#include // for SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for Uint16, Uint32 +#include // for string +#include "section.h" // for options_e +class Asset; +class Background; +class Fade; +class Input; +class Screen; +class Text; +struct JA_Music_t; /* Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones diff --git a/source/input.cpp b/source/input.cpp index adce7a2..de0d5cf 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -1,5 +1,9 @@ #include "input.h" -#include +#include // for SDL_INIT_GAMECONTROLLER, SDL_InitSubS... +#include // for SDL_GetError +#include // for SDL_ENABLE +#include // for SDL_GetKeyboardState +#include // for basic_ostream, operator<<, cout, basi... // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado Input *Input::input = nullptr; diff --git a/source/input.h b/source/input.h index 9f1ae97..03c8466 100644 --- a/source/input.h +++ b/source/input.h @@ -1,8 +1,11 @@ #pragma once -#include -#include -#include +#include // for SDL_GameControllerButton, SDL_G... +#include // for SDL_Joystick +#include // for SDL_Scancode +#include // for Uint8 +#include // for string, basic_string +#include // for vector /* connectedControllers es un vector donde estan todos los mandos encontrados [0 .. n] diff --git a/source/instructions.cpp b/source/instructions.cpp index 687e2fd..6becc67 100644 --- a/source/instructions.cpp +++ b/source/instructions.cpp @@ -1,8 +1,25 @@ #include "instructions.h" -#include "param.h" -#include "options.h" -#include "global_inputs.h" -#include +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_GetTicks +#include // for SDL_WINDOWEVENT_SIZE_CHANGED +#include // for max +#include // for basic_string +#include "asset.h" // for Asset +#include "fade.h" // for Fade, FADE_FULLSCREEN, FADE_IN +#include "global_inputs.h" // for checkGlobalInputs +#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, name_e, options, options_e +#include "sprite.h" // for Sprite +#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW +#include "texture.h" // for Texture +#include "tiled_bg.h" // for Tiledbg, TILED_MODE_STATIC +#include "utils.h" // for param_t, paramGame_t, color_t, shdwT... +struct JA_Music_t; // Constructor Instructions::Instructions(JA_Music_t *music) diff --git a/source/instructions.h b/source/instructions.h index c569364..ae04170 100644 --- a/source/instructions.h +++ b/source/instructions.h @@ -1,17 +1,19 @@ #pragma once -#include -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "screen.h" -#include "sprite.h" -#include "text.h" -#include "utils.h" -#include "lang.h" -#include "tiledbg.h" -#include "fade.h" -#include "section.h" +#include // for SDL_Event +#include // for SDL_Point, SDL_Rect +#include // for SDL_Texture, SDL_Renderer +#include // for Uint32 +#include // for vector +class Asset; +class Fade; +class Input; +class Screen; +class Sprite; +class Text; +class Texture; +class Tiledbg; +struct JA_Music_t; /* Esta clase gestiona un estado del programa. Se encarga de poner en pantalla diff --git a/source/intro.cpp b/source/intro.cpp index b2f2ce8..4e7910c 100644 --- a/source/intro.cpp +++ b/source/intro.cpp @@ -1,7 +1,22 @@ -#include "global_inputs.h" #include "intro.h" -#include "options.h" -#include "param.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 checkGlobalInputs +#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_e, options, options_e +#include "smart_sprite.h" // for SmartSprite +#include "text.h" // for Text +#include "texture.h" // for Texture +#include "utils.h" // for paramGame_t, param_t, zone_t, BLOCK +#include "writer.h" // for Writer +struct JA_Music_t; // Constructor Intro::Intro(JA_Music_t *music) diff --git a/source/intro.h b/source/intro.h index 39a3c33..d601377 100644 --- a/source/intro.h +++ b/source/intro.h @@ -1,16 +1,16 @@ #pragma once -#include -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "screen.h" -#include "smartsprite.h" -#include "utils.h" -#include "writer.h" -#include "lang.h" -#include -#include "section.h" +#include // for SDL_Event +#include // for Uint32, Uint8 +#include // for vector +class Asset; +class Input; +class Screen; +class SmartSprite; +class Text; +class Texture; +class Writer; +struct JA_Music_t; /* Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia diff --git a/source/item.cpp b/source/item.cpp index 3fa5c9f..e1d0386 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -1,5 +1,8 @@ #include "item.h" -#include "param.h" +#include // for rand +#include "animated_sprite.h" // for AnimatedSprite +#include "param.h" // for param +class Texture; // Constructor Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector *animation) diff --git a/source/item.h b/source/item.h index 6726855..007f701 100644 --- a/source/item.h +++ b/source/item.h @@ -1,8 +1,12 @@ #pragma once -#include -#include "animatedsprite.h" -#include "utils.h" +#include // for SDL_Rect +#include // for Uint16 +#include // for string +#include // for vector +#include "utils.h" // for circle_t +class AnimatedSprite; +class Texture; // Tipos de objetos #define ITEM_POINTS_1_DISK 1 diff --git a/source/jail_audio.cpp b/source/jail_audio.cpp index 4f63c2c..700e0b4 100644 --- a/source/jail_audio.cpp +++ b/source/jail_audio.cpp @@ -1,8 +1,10 @@ #ifndef JA_USESDLMIXER + #include "jail_audio.h" -#include "stb_vorbis.c" -#include -#include +#include // for uint8_t +#include // for NULL, fseek, fclose, fopen, fread, ftell, FILE +#include // for free, malloc +#include "stb_vorbis.c" // for stb_vorbis_decode_memory #define JA_MAX_SIMULTANEOUS_CHANNELS 5 diff --git a/source/jail_audio.h b/source/jail_audio.h index f4304d1..6407eed 100644 --- a/source/jail_audio.h +++ b/source/jail_audio.h @@ -1,12 +1,13 @@ #pragma once -#include + +#include // for SDL_AudioFormat +#include // for Uint32, Uint8 +struct JA_Music_t; // lines 5-5 +struct JA_Sound_t; // lines 6-6 enum JA_Channel_state { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED, JA_SOUND_DISABLED }; enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED, JA_MUSIC_DISABLED }; -struct JA_Sound_t; -struct JA_Music_t; - void JA_Init(const int freq, const SDL_AudioFormat format, const int channels); void JA_Quit(); diff --git a/source/jshader.cpp b/source/jail_shader.cpp similarity index 97% rename from source/jshader.cpp rename to source/jail_shader.cpp index 1243543..27044ee 100644 --- a/source/jshader.cpp +++ b/source/jail_shader.cpp @@ -1,7 +1,10 @@ #ifndef NO_SHADERS -#include "jshader.h" -#include +#include "jail_shader.h" +#include // for SDL_Point +#include // for NULL, free, malloc, exit +#include // for strncmp +#include // for basic_ostream, char_traits, operator<< #ifdef __APPLE__ #include "CoreFoundation/CoreFoundation.h" @@ -14,7 +17,6 @@ #endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 #else #include -#include #endif namespace shader diff --git a/source/jshader.h b/source/jail_shader.h similarity index 94% rename from source/jshader.h rename to source/jail_shader.h index 64652c3..4286871 100644 --- a/source/jshader.h +++ b/source/jail_shader.h @@ -2,7 +2,8 @@ #pragma once -#include +#include // for SDL_Texture +#include // for SDL_Window // TIPS: // ======================================================================= diff --git a/source/lang.cpp b/source/lang.cpp index 28c03aa..bea1687 100644 --- a/source/lang.cpp +++ b/source/lang.cpp @@ -1,6 +1,6 @@ #include "lang.h" -#include -#include +#include // for basic_ifstream, basic_istream, ifstream +#include // for vector namespace lang { diff --git a/source/lang.h b/source/lang.h index c1376d1..45df38f 100644 --- a/source/lang.h +++ b/source/lang.h @@ -1,8 +1,6 @@ #pragma once -#include -#include -#include +#include // for string namespace lang { diff --git a/source/logo.cpp b/source/logo.cpp index 57254f2..c228a12 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -1,8 +1,17 @@ #include "logo.h" -#include "param.h" -#include "options.h" -#include "global_inputs.h" -#include +#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 checkGlobalInputs +#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_e, options, options_e +#include "sprite.h" // for Sprite +#include "texture.h" // for Texture // Constructor Logo::Logo() diff --git a/source/logo.h b/source/logo.h index 40b0e25..7b6324e 100644 --- a/source/logo.h +++ b/source/logo.h @@ -1,15 +1,15 @@ #pragma once -#include -#include -#include "asset.h" -#include "input.h" -#include "jail_audio.h" -#include "lang.h" -#include "screen.h" -#include "section.h" -#include "sprite.h" -#include "utils.h" +#include // for SDL_Event +#include // for SDL_Point +#include // for Uint32 +#include // for vector +#include "utils.h" // for color_t +class Asset; +class Input; +class Screen; +class Sprite; +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 8c7eb8b..7855748 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -7,8 +7,9 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024 */ -#include "director.h" -#include +#include // for basic_ostream, char_traits, operator<<, cout +#include // for basic_string, operator<<, string +#include "director.h" // for Director int main(int argc, char *argv[]) { diff --git a/source/manage_hiscore_table.cpp b/source/manage_hiscore_table.cpp index 6ce055b..5f3070c 100644 --- a/source/manage_hiscore_table.cpp +++ b/source/manage_hiscore_table.cpp @@ -1,5 +1,10 @@ #include "manage_hiscore_table.h" -#include +#include // for SDL_GetError +#include // for SDL_RWread, SDL_RWwrite, SDL_RWFromFile +#include // for free, malloc +#include // for sort +#include // for basic_ostream, char_traits, operator<< +#include "utils.h" // for hiScoreEntry_t // Constructor ManageHiScoreTable::ManageHiScoreTable(std::vector *table) diff --git a/source/manage_hiscore_table.h b/source/manage_hiscore_table.h index 86ccbb8..bc778cc 100644 --- a/source/manage_hiscore_table.h +++ b/source/manage_hiscore_table.h @@ -1,7 +1,8 @@ #pragma once -#include -#include "utils.h" +#include // for string +#include // for vector +struct hiScoreEntry_t; /* Esta clase sirve para añadir elementos hiScoreEntry_r a un vector (tabla), de manera diff --git a/source/movingsprite.cpp b/source/moving_sprite.cpp similarity index 99% rename from source/movingsprite.cpp rename to source/moving_sprite.cpp index 7de07ec..a838598 100644 --- a/source/movingsprite.cpp +++ b/source/moving_sprite.cpp @@ -1,4 +1,5 @@ -#include "movingsprite.h" +#include "moving_sprite.h" +#include "texture.h" // for Texture // Constructor MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture) diff --git a/source/movingsprite.h b/source/moving_sprite.h similarity index 95% rename from source/movingsprite.h rename to source/moving_sprite.h index c6f4fd8..6b4560d 100644 --- a/source/movingsprite.h +++ b/source/moving_sprite.h @@ -1,7 +1,10 @@ #pragma once -#include -#include "sprite.h" +#include // for SDL_Rect, SDL_Point +#include // for SDL_RendererFlip +#include // for Uint16 +#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 54ab98d..340039b 100644 --- a/source/notify.cpp +++ b/source/notify.cpp @@ -1,8 +1,12 @@ #include "notify.h" -#include "options.h" -#include -#include -#include +#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 "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, std::string soundFile) diff --git a/source/notify.h b/source/notify.h index 6506282..45c2f0a 100644 --- a/source/notify.h +++ b/source/notify.h @@ -1,12 +1,14 @@ #pragma once -#include -#include "jail_audio.h" -#include "sprite.h" -#include "text.h" -#include "texture.h" -#include "utils.h" -#include +#include // for SDL_Rect +#include // for SDL_Renderer +#include // for basic_string, string +#include // for vector +#include "utils.h" // for color_t +class Sprite; +class Text; +class Texture; +struct JA_Sound_t; #ifndef NOTIFY_H #define NOTIFY_H diff --git a/source/options.cpp b/source/options.cpp index ebc764d..950c692 100644 --- a/source/options.cpp +++ b/source/options.cpp @@ -1,8 +1,14 @@ #include "options.h" -#include "screen.h" -#include "lang.h" -#include -#include +#include // for SDL_GameControllerButton, SDL_C... +#include // for SDL_WINDOW_FULLSCREEN, SDL_WIND... +#include // for max, min +#include // for char_traits, basic_ostream, ope... +#include // for cout +#include // for vector +#include "input.h" // for inputs_e, INPUT_USE_ANY, INPUT_... +#include "lang.h" // for lang_e +#include "screen.h" // for SCREEN_FILTER_NEAREST, SCREEN_V... +#include "utils.h" // for op_controller_t, options_t, op_... // Variables options_t options; diff --git a/source/options.h b/source/options.h index 8ce5260..0bb4818 100644 --- a/source/options.h +++ b/source/options.h @@ -1,7 +1,7 @@ #pragma once -#include -#include "utils.h" +#include // for string +struct options_t; // Variables extern options_t options; diff --git a/source/param.cpp b/source/param.cpp index fef38cc..7e9455e 100644 --- a/source/param.cpp +++ b/source/param.cpp @@ -1,6 +1,7 @@ #include "param.h" -#include -#include +#include // for char_traits, basic_ostream, basic_ifstream, basi... +#include // for cout +#include "utils.h" // for param_t, paramGame_t, zone_t, paramBalloon_t param_t param; diff --git a/source/param.h b/source/param.h index 1b62624..77004f9 100644 --- a/source/param.h +++ b/source/param.h @@ -1,7 +1,7 @@ #pragma once -#include -#include "utils.h" +#include // for string +struct param_t; extern param_t param; diff --git a/source/player.cpp b/source/player.cpp index f0e7c74..b2b0ab8 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -1,5 +1,12 @@ #include "player.h" -#include "param.h" +#include // for SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE, SDL... +#include // for SDL_GetTicks +#include // for rand +#include // for max, min +#include "animated_sprite.h" // for AnimatedSprite +#include "input.h" // for inputs_e +#include "param.h" // for param +#include "texture.h" // for Texture // Constructor Player::Player(int id, float x, int y, SDL_Rect *playArea, std::vector texture, std::vector *> animations) diff --git a/source/player.h b/source/player.h index 9b1f542..993489f 100644 --- a/source/player.h +++ b/source/player.h @@ -1,11 +1,12 @@ #pragma once -#include -#include "animatedsprite.h" -#include "asset.h" -#include "input.h" -#include "texture.h" -#include "utils.h" +#include // for SDL_Rect +#include // for Uint32 +#include // for string, basic_string +#include // for vector +#include "utils.h" // for circle_t +class AnimatedSprite; +class Texture; // Estados del jugador #define PLAYER_STATUS_WALKING_LEFT 0 diff --git a/source/scoreboard.cpp b/source/scoreboard.cpp index c1cc9b0..9dc3927 100644 --- a/source/scoreboard.cpp +++ b/source/scoreboard.cpp @@ -1,5 +1,13 @@ #include "scoreboard.h" -#include +#include // for SDL_BLENDMODE_BLEND +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_GetTicks +#include // for roundf +#include "asset.h" // for Asset +#include "lang.h" // for getText +#include "sprite.h" // for Sprite +#include "text.h" // for Text +#include "texture.h" // for Texture // Constructor Scoreboard::Scoreboard(SDL_Renderer *renderer) diff --git a/source/scoreboard.h b/source/scoreboard.h index d2d216f..42232d5 100644 --- a/source/scoreboard.h +++ b/source/scoreboard.h @@ -1,12 +1,15 @@ #pragma once -#include -#include "asset.h" -#include "screen.h" -#include "sprite.h" -#include "text.h" -#include "utils.h" -#include "lang.h" +#include // for SDL_Point, SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for Uint32 +#include // for string, basic_string +#include // for vector +#include "utils.h" // for color_t +class Asset; +class Sprite; +class Text; +class Texture; // Defines #define SCOREBOARD_LEFT_PANEL 0 diff --git a/source/screen.cpp b/source/screen.cpp index 87fc2f0..303224c 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -1,13 +1,21 @@ #include "screen.h" -#include "options.h" -#include -#include -#include -#include +#include // for SDL_DISABLE, SDL_ENABLE +#include // for SDL_ShowCursor +#include // for SDL_PIXELFORMAT_RGBA8888 +#include // for SDL_GetTicks +#include // for max, min +#include // for basic_ifstream, ifstream +#include // for istreambuf_iterator, operator!= +#include // for basic_string, operator+, to_string, cha... +#include "asset.h" // for Asset +#include "dbgtxt.h" // for dbg_print +#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT +#include "notify.h" // for Notify +#include "options.h" // for options + #ifndef NO_SHADERS -#include "jshader.h" +#include "jail_shader.h" // for init, render #endif -#include "dbgtxt.h" // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado Screen *Screen::screen = nullptr; diff --git a/source/screen.h b/source/screen.h index d0cd5e8..8fd7afc 100644 --- a/source/screen.h +++ b/source/screen.h @@ -1,11 +1,15 @@ #pragma once -#include -#include -#include "asset.h" -#include "input.h" -#include "notify.h" -#include "utils.h" +#include // for SDL_BlendMode +#include // for SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for Uint32 +#include // for SDL_Window +#include // for basic_string, string +#include "utils.h" // for color_t +class Asset; +class Input; +class Notify; #define SCREEN_FILTER_NEAREST 0 #define SCREEN_FILTER_LINEAL 1 diff --git a/source/section.h b/source/section.h index 209be13..04ccd6d 100644 --- a/source/section.h +++ b/source/section.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace section { // Secciones del programa diff --git a/source/smartsprite.cpp b/source/smart_sprite.cpp similarity index 97% rename from source/smartsprite.cpp rename to source/smart_sprite.cpp index cb7e4d8..7858e38 100644 --- a/source/smartsprite.cpp +++ b/source/smart_sprite.cpp @@ -1,4 +1,6 @@ -#include "smartsprite.h" +#include "smart_sprite.h" +#include "moving_sprite.h" // for MovingSprite +class Texture; // Constructor SmartSprite::SmartSprite(Texture *texture) diff --git a/source/smartsprite.h b/source/smart_sprite.h similarity index 93% rename from source/smartsprite.h rename to source/smart_sprite.h index 305fa0d..2f211ce 100644 --- a/source/smartsprite.h +++ b/source/smart_sprite.h @@ -1,9 +1,7 @@ #pragma once -#include -#include "animatedsprite.h" -#include "utils.h" -#include +#include "animated_sprite.h" // for AnimatedSprite +class Texture; // Clase SmartSprite class SmartSprite : public AnimatedSprite diff --git a/source/sprite.cpp b/source/sprite.cpp index f03668a..e19114c 100644 --- a/source/sprite.cpp +++ b/source/sprite.cpp @@ -1,4 +1,5 @@ #include "sprite.h" +#include "texture.h" // for Texture // Constructor Sprite::Sprite(int x, int y, int w, int h, Texture *texture) diff --git a/source/sprite.h b/source/sprite.h index 28bb3e1..bd533a1 100644 --- a/source/sprite.h +++ b/source/sprite.h @@ -1,7 +1,7 @@ #pragma once -#include -#include "texture.h" +#include // for SDL_Rect, SDL_Point +class Texture; // Clase sprite class Sprite diff --git a/source/text.cpp b/source/text.cpp index ae67c2d..9ec9182 100644 --- a/source/text.cpp +++ b/source/text.cpp @@ -1,7 +1,9 @@ - #include "text.h" -#include -#include +#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_t // Llena una estructuta textFile_t desde un fichero textFile_t LoadTextFile(std::string file, bool verbose) diff --git a/source/text.h b/source/text.h index b246575..9c6859d 100644 --- a/source/text.h +++ b/source/text.h @@ -1,7 +1,11 @@ #pragma once -#include "sprite.h" +#include // for SDL_Renderer +#include // for Uint8 +#include // for string #include "utils.h" +class Sprite; // lines 6-6 +class Texture; // lines 7-7 #define TXT_COLOR 1 #define TXT_SHADOW 2 diff --git a/source/texture.cpp b/source/texture.cpp index e40d56f..0204bae 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -1,12 +1,17 @@ #include "texture.h" +#include // for SDL_GetError +#include // for SDL_CreateRGBSurfaceWithFormatFrom +#include // for SEEK_END, SEEK_SET +#include // for fseek, fclose, fopen, fread, ftell, NULL +#include // for malloc, free, exit +#include // for basic_ostream, operator<<, cout, endl +#include "gif.c" // for LoadGif, LoadPalette #define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" -#include "gif.c" -#include +#include "stb_image.h" // for stbi_failure_reason, stbi_image_free // Constructor -Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose) +Texture::Texture(SDL_Renderer *renderer, std::string path) { // Copia punteros this->renderer = renderer; @@ -29,7 +34,7 @@ Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose) // .png if (extension == "png") { - loadFromFile(path, verbose); + loadFromFile(path); } // .gif @@ -53,7 +58,7 @@ Texture::~Texture() } // Carga una imagen desde un fichero -bool Texture::loadFromFile(std::string path, bool verbose) +bool Texture::loadFromFile(std::string path) { const std::string filename = path.substr(path.find_last_of("\\/") + 1); int req_format = STBI_rgb_alpha; @@ -61,15 +66,16 @@ bool Texture::loadFromFile(std::string path, bool verbose) unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format); if (data == nullptr) { - SDL_Log("Loading image failed: %s", stbi_failure_reason()); +#ifdef VERBOSE + std::cout << "Loading image failed: " << stbi_failure_reason() << std::endl; +#endif exit(1); } else { - if (verbose) - { - std::cout << "Image loaded: " << filename.c_str() << std::endl; - } +#ifdef VERBOSE + std::cout << "Image loaded: " << filename.c_str() << std::endl; +#endif } int depth, pitch; @@ -97,10 +103,9 @@ bool Texture::loadFromFile(std::string path, bool verbose) SDL_Surface *loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom((void *)data, width, height, depth, pitch, pixel_format); if (loadedSurface == nullptr) { - if (verbose) - { - std::cout << "Unable to load image " << path.c_str() << std::endl; - } +#ifdef VERBOSE + std::cout << "Unable to load image " << path.c_str() << std::endl; +#endif } else { @@ -108,10 +113,9 @@ bool Texture::loadFromFile(std::string path, bool verbose) newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface); if (newTexture == nullptr) { - if (verbose) - { - std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl; - } +#ifdef VERBOSE + std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl; +#endif } else { @@ -227,7 +231,7 @@ int Texture::getHeight() // Recarga la textura bool Texture::reLoad() { - return loadFromFile(path, renderer); + return loadFromFile(path); } // Obtiene la textura diff --git a/source/texture.h b/source/texture.h index 9c15b16..a733207 100644 --- a/source/texture.h +++ b/source/texture.h @@ -1,9 +1,12 @@ #pragma once -#include -#include -#include -#include +#include // for SDL_BlendMode +#include // for SDL_PIXELFORMAT_RGBA8888, SDL_PixelF... +#include // for SDL_Point, SDL_Rect +#include // for SDL_Renderer, SDL_FLIP_NONE, SDL_TEX... +#include // for Uint8, Uint32, Uint16 +#include // for string, basic_string +#include // for vector // Definiciones de tipos struct surface_s @@ -46,13 +49,13 @@ private: public: // Constructor - Texture(SDL_Renderer *renderer, std::string path = "", bool verbose = false); + Texture(SDL_Renderer *renderer, std::string path = ""); // Destructor ~Texture(); // Carga una imagen desde un fichero - bool loadFromFile(std::string path, bool verbose = false); + bool loadFromFile(std::string path); // Crea una textura en blanco bool createBlank(int width, int height, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING); diff --git a/source/tiledbg.cpp b/source/tiled_bg.cpp similarity index 90% rename from source/tiledbg.cpp rename to source/tiled_bg.cpp index c979571..1e1d853 100644 --- a/source/tiledbg.cpp +++ b/source/tiled_bg.cpp @@ -1,6 +1,10 @@ -#include "screen.h" -#include "sprite.h" -#include "tiledbg.h" +#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 // Constructor Tiledbg::Tiledbg(std::string texturePath, SDL_Rect pos, int mode) diff --git a/source/tiledbg.h b/source/tiled_bg.h similarity index 90% rename from source/tiledbg.h rename to source/tiled_bg.h index decb225..28898a6 100644 --- a/source/tiledbg.h +++ b/source/tiled_bg.h @@ -1,6 +1,8 @@ #pragma once -#include +#include // for SDL_Rect +#include // for SDL_Renderer, SDL_Texture +#include // for string, basic_string // Modos de funcionamiento para el tileado de fondo #define TILED_MODE_CIRCLE 0 diff --git a/source/title.cpp b/source/title.cpp index 0b0a443..0f76c10 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -1,7 +1,26 @@ -#include "global_inputs.h" -#include "options.h" -#include "param.h" #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 "define_buttons.h" // for DefineButtons +#include "fade.h" // for Fade, FADE_RANDOM_SQUARE +#include "game_logo.h" // for GameLogo +#include "global_inputs.h" // for checkGlobalInputs +#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 options_e, options, name_e, name +#include "sprite.h" // for Sprite +#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW +#include "texture.h" // for Texture +#include "tiled_bg.h" // for Tiledbg, TILED_MODE_RANDOM +struct JA_Music_t; // Constructor Title::Title(JA_Music_t *music) diff --git a/source/title.h b/source/title.h index 80389cc..b114d78 100644 --- a/source/title.h +++ b/source/title.h @@ -1,25 +1,19 @@ #pragma once -#include -#include "asset.h" -#include "define_buttons.h" -#include "fade.h" -#include "game.h" -#include "game_logo.h" -#include "hiscore_table.h" -#include "input.h" -#include "instructions.h" -#include "item.h" -#include "jail_audio.h" -#include "lang.h" -#include "movingsprite.h" -#include "screen.h" -#include "section.h" -#include "smartsprite.h" -#include "sprite.h" -#include "text.h" -#include "tiledbg.h" -#include "utils.h" +#include // for SDL_Event +#include // for Uint32 +#include "utils.h" // for section_t +class Asset; +class DefineButtons; +class Fade; +class GameLogo; +class Input; +class Screen; +class Sprite; +class Text; +class Texture; +class Tiledbg; +struct JA_Music_t; // Textos #define TEXT_COPYRIGHT "@2020,2024 JailDesigner" diff --git a/source/utils.cpp b/source/utils.cpp index d127696..56fbeeb 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,5 +1,7 @@ #include "utils.h" -#include +#include // for free, malloc +struct JA_Music_t; +struct JA_Sound_t; // Colores const color_t bgColor = {0x27, 0x27, 0x36}; diff --git a/source/utils.h b/source/utils.h index 3204c61..788c01d 100644 --- a/source/utils.h +++ b/source/utils.h @@ -1,10 +1,15 @@ #pragma once -#include -#include -#include -#include "input.h" -#include "jail_audio.h" +#include // for SDL_GameControllerButton +#include // for SDL_Rect, SDL_Point +#include // for SDL_Renderer +#include // for Uint8, Uint32 +#include // for int32_t +#include // for string, basic_string +#include // for vector +#include "input.h" // for inputs_e +struct JA_Music_t; +struct JA_Sound_t; // Dificultad del juego #define DIFFICULTY_EASY 0 diff --git a/source/writer.cpp b/source/writer.cpp index 7035f32..137ea6b 100644 --- a/source/writer.cpp +++ b/source/writer.cpp @@ -1,4 +1,5 @@ #include "writer.h" +#include "text.h" // for Text // Constructor Writer::Writer(Text *text) diff --git a/source/writer.h b/source/writer.h index 38c9a6b..d8eae81 100644 --- a/source/writer.h +++ b/source/writer.h @@ -1,8 +1,7 @@ #pragma once -#include -#include "sprite.h" -#include "text.h" +#include // for string, basic_string +class Text; // Clase Writer. Pinta texto en pantalla letra a letra a partir de una cadena y un bitmap class Writer diff --git a/todo.txt b/todo.txt deleted file mode 100644 index 3dbced3..0000000 --- a/todo.txt +++ /dev/null @@ -1,16 +0,0 @@ -[] Cargar todos los graficos al inicio -[x] Independizar el pintado del fondo del juego -[] Cambiar la resolución a 320x240 -[] Permitir entrar al segundo jugador en caliente -[] Arreglar la pantalla de titulo -[] Hacer el marcador transparente -[] Valorar la opcion de que write devuelva texturas con el texto en lugar de pintar letra a letra -[] Arreglar los anclajes en la pantalla de game over -[] Al poner pausa, que se sigan moviendo las nubes -[] Revisar la clase Fade -[x] Quitar los static de title / crear clase para el logo de coffee crisis -[] Añadir mini logo a pantalla de titulo -[] Estandarizar tipografias, dejar solo una (o dos) -[] Crear objeto encargado de los mensajes en pantalla (en vez de ser la clase game) -[] ABSOLUTAMENTE TODO ha de estar en un fichero de texto y en una variable PARAMETROS: fisicas, tamaños de zona de juego, formaciones enemigas... -[] Añadir notificaciones para el cambio de tamaño de ventana, shaders, filtro, mute, etc... \ No newline at end of file