Pasaeta de "include-what-you-use" per arreglar els includes

Renombrats alguns fitxers per consistencia
This commit is contained in:
2024-09-29 06:24:11 +02:00
parent ac3340c39f
commit 28df97ea94
82 changed files with 616 additions and 350 deletions

6
go.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
SECONDS=0
make linux_debug
duration=$SECONDS
echo "$((duration / 60)) minutes and $((duration % 60)) seconds elapsed."

View File

@@ -1,7 +1,8 @@
#include "animatedsprite.h" #include "animated_sprite.h"
#include <fstream> #include <fstream> // for basic_ostream, operator<<, basic_istream, basic...
#include <iostream> #include <iostream> // for cout
#include <sstream> #include <sstream> // for basic_stringstream
#include "texture.h" // for Texture
// Carga la animación desde un fichero // Carga la animación desde un fichero
animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath, bool verbose) animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath, bool verbose)

View File

@@ -1,9 +1,11 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "movingsprite.h" #include <SDL2/SDL_stdinc.h> // for Uint8
#include <string> #include <string> // for string, basic_string
#include <vector> #include <vector> // for vector
#include "moving_sprite.h" // for MovingSprite
class Texture;
struct animation_t struct animation_t
{ {

View File

@@ -1,5 +1,8 @@
#include "asset.h" #include "asset.h"
#include <iostream> #include <SDL2/SDL_rwops.h> // for SDL_RWFromFile, SDL_RWclose, SDL_RWops
#include <SDL2/SDL_stdinc.h> // for SDL_max
#include <stddef.h> // for size_t
#include <iostream> // for basic_ostream, operator<<, cout, endl
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Asset *Asset::asset = nullptr; Asset *Asset::asset = nullptr;

View File

@@ -1,8 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string, basic_string
#include <string> #include <vector> // for vector
#include <vector>
enum assetType enum assetType
{ {

View File

@@ -1,5 +1,13 @@
#include "background.h" #include "background.h"
#include "param.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <algorithm> // for max, min
#include <string> // 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 // Constructor
Background::Background(SDL_Renderer *renderer) Background::Background(SDL_Renderer *renderer)

View File

@@ -1,9 +1,12 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "asset.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "movingsprite.h" #include "utils.h" // for color_t
#include "utils.h" class Asset;
class MovingSprite;
class Sprite;
class Texture;
/* /*
Esta clase es la encargada de dibujar el fondo que aparece durante la sección Esta clase es la encargada de dibujar el fondo que aparece durante la sección

View File

@@ -1,5 +1,11 @@
#include "balloon.h" #include "balloon.h"
#include "param.h" #include <bits/std_abs.h> // for abs
#include <math.h> // 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 // Constructor
Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, Texture *texture, std::vector<std::string> *animation) Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, Texture *texture, std::vector<std::string> *animation)

View File

@@ -1,10 +1,11 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_stdinc.h> // for Uint8, Uint16, Uint32
#include "animatedsprite.h" #include <string> // for string
#include "utils.h" #include <vector> // for vector
#include <sstream> #include "utils.h" // for circle_t
#include <vector> class AnimatedSprite;
class Texture;
// Cantidad de elementos del vector con los valores de la deformación del globo al rebotar // Cantidad de elementos del vector con los valores de la deformación del globo al rebotar
#define MAX_BOUNCE 10 #define MAX_BOUNCE 10

View File

@@ -1,5 +1,7 @@
#include "bullet.h" #include "bullet.h"
#include "param.h" #include "param.h" // for param
#include "sprite.h" // for Sprite
class Texture;
// Constructor // Constructor
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture) Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture)

View File

@@ -1,8 +1,10 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "sprite.h" #include <SDL2/SDL_stdinc.h> // for Uint8
#include "utils.h" #include "utils.h" // for circle_t
class Sprite;
class Texture;
// Tipos de bala // Tipos de bala
#define BULLET_UP 1 #define BULLET_UP 1

View File

@@ -1,9 +1,12 @@
#include "dbgtxt.h" #include "dbgtxt.h"
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_rwops.h> // for SDL_RWFromMem
#include <SDL2/SDL_surface.h> // for SDL_LoadBMP_RW
namespace namespace
{ {
SDL_Texture *dbg_tex = NULL; SDL_Texture *dbg_tex = nullptr;
SDL_Renderer *dbg_ren = NULL; SDL_Renderer *dbg_ren = nullptr;
} }
void dbg_init(SDL_Renderer *renderer) void dbg_init(SDL_Renderer *renderer)

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_render.h> // for SDL_Renderer
#include <SDL2/SDL_stdinc.h> // for Uint8
void dbg_init(SDL_Renderer *renderer); void dbg_init(SDL_Renderer *renderer);
void dbg_print(int x, int y, const char *text, Uint8 r, Uint8 g, Uint8 b); void dbg_print(int x, int y, const char *text, Uint8 r, Uint8 g, Uint8 b);

View File

@@ -1,7 +1,10 @@
#include "define_buttons.h" #include "define_buttons.h"
#include "param.h" #include "lang.h" // for getText
#include "options.h" #include "options.h" // for options
#include "section.h" #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 // Constructor
DefineButtons::DefineButtons(Text *text) DefineButtons::DefineButtons(Text *text)

View File

@@ -1,9 +1,11 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_ControllerButtonEvent
#include "input.h" #include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton
#include "text.h" #include <string> // for string, basic_string
#include "lang.h" #include <vector> // for vector
#include "input.h" // for inputs_e
class Text;
struct db_button_t struct db_button_t
{ {

View File

@@ -1,17 +1,38 @@
#include "director.h" #include "director.h"
#include "utils.h" #include <SDL2/SDL.h> // for SDL_Init, SDL_Quit, SDL_INIT_EV...
#include "options.h" #include <SDL2/SDL_audio.h> // for AUDIO_S16
#include "section.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <iostream> #include <SDL2/SDL_error.h> // for SDL_GetError
#include <fstream> #include <SDL2/SDL_gamecontroller.h> // for SDL_CONTROLLER_BUTTON_B, SDL_CO...
#include <string> #include <SDL2/SDL_hints.h> // for SDL_SetHint, SDL_HINT_RENDER_DR...
#include <sys/stat.h> #include <SDL2/SDL_scancode.h> // for SDL_SCANCODE_DOWN, SDL_SCANCODE_E
#include <unistd.h> #include <SDL2/SDL_stdinc.h> // for Uint32
#include "dbgtxt.h" #include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <errno.h> // for errno, EACCES, EEXIST, ENAMETOO...
#ifndef _WIN32 #include <pwd.h> // for getpwuid, passwd
#include <pwd.h> #include <stdio.h> // for printf, perror, size_t
#endif #include <string.h> // for strcmp
#include <sys/stat.h> // for stat, mkdir, S_IRWXU
#include <unistd.h> // for getuid
#include <cstdlib> // for exit, EXIT_FAILURE, rand, srand
#include <iostream> // for basic_ostream, operator<<, cout
#include <string> // 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 // Constructor
Director::Director(int argc, char *argv[]) Director::Director(int argc, char *argv[])

View File

@@ -1,22 +1,20 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "asset.h" #include <SDL2/SDL_video.h> // for SDL_Window
#include "input.h" #include <string> // for string, basic_string
#include "jail_audio.h" #include <vector> // for vector
#include "screen.h" #include "lang.h" // for lang_e
#include "text.h" #include "utils.h" // for music_file_t, sound_file_t
#include "utils.h" class Asset;
#include "fade.h" class Game;
#include "game.h" class HiScoreTable;
#include "intro.h" class Input;
#include "item.h" class Instructions;
#include "lang.h" class Intro;
#include "logo.h" class Logo;
#include "player.h" class Screen;
#include "title.h" class Title;
#include "param.h"
#include "manage_hiscore_table.h"
// Textos // Textos
#define WINDOW_CAPTION "Coffee Crisis Arcade Edition" #define WINDOW_CAPTION "Coffee Crisis Arcade Edition"

View File

@@ -1,5 +1,7 @@
#include "enemy_formations.h" #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 // Constructor
EnemyFormations::EnemyFormations() EnemyFormations::EnemyFormations()

View File

@@ -1,9 +1,5 @@
#pragma once #pragma once
#include <SDL2/SDL.h>
#include "utils.h"
#include "balloon.h"
#define NUMBER_OF_ENEMY_FORMATIONS 100 #define NUMBER_OF_ENEMY_FORMATIONS 100
#define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50 #define MAX_NUMBER_OF_ENEMIES_IN_A_FORMATION 50

View File

@@ -1,4 +1,5 @@
#include "enter_name.h" #include "enter_name.h"
#include <algorithm> // for max, min
// Constructor // Constructor
EnterName::EnterName(std::string *name) EnterName::EnterName(std::string *name)

View File

@@ -1,4 +1,6 @@
#include "explosions.h" #include "explosions.h"
#include "animated_sprite.h" // for AnimatedSprite
class Texture;
// Constructor // Constructor
Explosions::Explosions() Explosions::Explosions()

View File

@@ -1,9 +1,9 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string
#include "texture.h" #include <vector> // for vector
#include "animatedsprite.h" class AnimatedSprite;
#include <vector> class Texture;
struct explosion_texture_t struct explosion_texture_t
{ {

View File

@@ -1,6 +1,10 @@
#include "fade.h" #include "fade.h"
#include "param.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND, SDL_BLENDMODE_NONE
#include <iostream> #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <stdlib.h> // for rand
#include <algorithm> // for min, max
#include "param.h" // for param
#include "utils.h" // for param_t, paramGame_t, paramFade_t
// Constructor // Constructor
Fade::Fade(SDL_Renderer *renderer) Fade::Fade(SDL_Renderer *renderer)

View File

@@ -1,8 +1,9 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "texture.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "utils.h" #include <SDL2/SDL_stdinc.h> // for Uint8, Uint16
#include <vector> // for vector
// Tipos de fundido // Tipos de fundido
#define FADE_FULLSCREEN 0 #define FADE_FULLSCREEN 0

View File

@@ -1,7 +1,36 @@
#include "game.h" #include "game.h"
#include "param.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include "options.h" #include <SDL2/SDL_keycode.h> // for SDLK_1, SDLK_2, SDLK_3, SDLK_h
#include <fstream> #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_rwops.h> // for SDL_RWFromFile, SDL_RWclose, SDL_R...
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_FOCUS_GAINED, SDL_...
#include <stdlib.h> // for rand
#include <algorithm> // for min
#include <fstream> // for basic_ifstream
#include <iostream> // 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 #define GAME_OVER_COUNTER 350

View File

@@ -1,28 +1,29 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include "balloon.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "bullet.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "asset.h" #include <string> // for string
#include "input.h" #include <vector> // for vector
#include "jail_audio.h" #include "section.h" // for options_e
#include "movingsprite.h" #include "utils.h" // for demoKeys_t, color_t, hiScoreEntry_t
#include "screen.h" class Asset;
#include "smartsprite.h" class Background;
#include "sprite.h" class Balloon;
#include "text.h" class Bullet;
#include "utils.h" class EnemyFormations;
#include "fade.h" class Explosions;
#include "item.h" class Fade;
#include "player.h" class Input;
#include "scoreboard.h" class Item;
#include "background.h" class Player;
#include "lang.h" class Scoreboard;
#include "manage_hiscore_table.h" class Screen;
#include "explosions.h" class SmartSprite;
#include "enemy_formations.h" class Text;
#include "section.h" class Texture;
#include <iostream> struct JA_Music_t;
struct JA_Sound_t;
#define GAME_MODE_DEMO_OFF false #define GAME_MODE_DEMO_OFF false
#define GAME_MODE_DEMO_ON true #define GAME_MODE_DEMO_ON true

View File

@@ -1,5 +1,15 @@
#include "game_logo.h" #include "game_logo.h"
#include "param.h" #include <algorithm> // for max
#include <string> // 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 // Constructor
GameLogo::GameLogo(int x, int y) GameLogo::GameLogo(int x, int y)

View File

@@ -1,10 +1,13 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "asset.h" class AnimatedSprite;
#include "screen.h" class Asset;
#include "smartsprite.h" class Screen;
#include "jail_audio.h" class SmartSprite;
class Sprite;
class Texture;
struct JA_Sound_t;
// Clase GameLogo // Clase GameLogo
class GameLogo class GameLogo

View File

@@ -1,9 +1,12 @@
#include "global_inputs.h" #include "global_inputs.h"
#include "section.h" #include <string> // for basic_string, operator+
#include "screen.h" #include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT
#include "input.h" #include "jail_audio.h" // for JA_EnableMusic, JA_EnableSound
#include "lang.h" #include "lang.h" // for getText
#include "options.h" #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 // Termina
void quit(section::options_e code) void quit(section::options_e code)

View File

@@ -1,8 +1,22 @@
#include <iostream>
#include "global_inputs.h"
#include "hiscore_table.h" #include "hiscore_table.h"
#include "options.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include "param.h" #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
#include <algorithm> // for max
#include <vector> // 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 // Constructor
HiScoreTable::HiScoreTable(JA_Music_t *music) HiScoreTable::HiScoreTable(JA_Music_t *music)

View File

@@ -1,17 +1,18 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include "asset.h" #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "input.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "jail_audio.h" #include <SDL2/SDL_stdinc.h> // for Uint16, Uint32
#include "screen.h" #include <string> // for string
#include "sprite.h" #include "section.h" // for options_e
#include "text.h" class Asset;
#include "utils.h" class Background;
#include "lang.h" class Fade;
#include "fade.h" class Input;
#include "background.h" class Screen;
#include "section.h" class Text;
struct JA_Music_t;
/* /*
Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones

View File

@@ -1,5 +1,9 @@
#include "input.h" #include "input.h"
#include <iostream> #include <SDL2/SDL.h> // for SDL_INIT_GAMECONTROLLER, SDL_InitSubS...
#include <SDL2/SDL_error.h> // for SDL_GetError
#include <SDL2/SDL_events.h> // for SDL_ENABLE
#include <SDL2/SDL_keyboard.h> // for SDL_GetKeyboardState
#include <iostream> // for basic_ostream, operator<<, cout, basi...
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Input *Input::input = nullptr; Input *Input::input = nullptr;

View File

@@ -1,8 +1,11 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton, SDL_G...
#include <string> #include <SDL2/SDL_joystick.h> // for SDL_Joystick
#include <vector> #include <SDL2/SDL_scancode.h> // for SDL_Scancode
#include <SDL2/SDL_stdinc.h> // for Uint8
#include <string> // for string, basic_string
#include <vector> // for vector
/* /*
connectedControllers es un vector donde estan todos los mandos encontrados [0 .. n] connectedControllers es un vector donde estan todos los mandos encontrados [0 .. n]

View File

@@ -1,8 +1,25 @@
#include "instructions.h" #include "instructions.h"
#include "param.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include "options.h" #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include "global_inputs.h" #include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <iostream> #include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
#include <algorithm> // for max
#include <string> // 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 // Constructor
Instructions::Instructions(JA_Music_t *music) Instructions::Instructions(JA_Music_t *music)

View File

@@ -1,17 +1,19 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include "asset.h" #include <SDL2/SDL_rect.h> // for SDL_Point, SDL_Rect
#include "input.h" #include <SDL2/SDL_render.h> // for SDL_Texture, SDL_Renderer
#include "jail_audio.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "screen.h" #include <vector> // for vector
#include "sprite.h" class Asset;
#include "text.h" class Fade;
#include "utils.h" class Input;
#include "lang.h" class Screen;
#include "tiledbg.h" class Sprite;
#include "fade.h" class Text;
#include "section.h" class Texture;
class Tiledbg;
struct JA_Music_t;
/* /*
Esta clase gestiona un estado del programa. Se encarga de poner en pantalla Esta clase gestiona un estado del programa. Se encarga de poner en pantalla

View File

@@ -1,7 +1,22 @@
#include "global_inputs.h"
#include "intro.h" #include "intro.h"
#include "options.h" #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "param.h" #include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
#include <string> // 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 // Constructor
Intro::Intro(JA_Music_t *music) Intro::Intro(JA_Music_t *music)

View File

@@ -1,16 +1,16 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include "asset.h" #include <SDL2/SDL_stdinc.h> // for Uint32, Uint8
#include "input.h" #include <vector> // for vector
#include "jail_audio.h" class Asset;
#include "screen.h" class Input;
#include "smartsprite.h" class Screen;
#include "utils.h" class SmartSprite;
#include "writer.h" class Text;
#include "lang.h" class Texture;
#include <vector> class Writer;
#include "section.h" struct JA_Music_t;
/* /*
Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia

View File

@@ -1,5 +1,8 @@
#include "item.h" #include "item.h"
#include "param.h" #include <stdlib.h> // for rand
#include "animated_sprite.h" // for AnimatedSprite
#include "param.h" // for param
class Texture;
// Constructor // Constructor
Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation) Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation)

View File

@@ -1,8 +1,12 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "animatedsprite.h" #include <SDL2/SDL_stdinc.h> // for Uint16
#include "utils.h" #include <string> // for string
#include <vector> // for vector
#include "utils.h" // for circle_t
class AnimatedSprite;
class Texture;
// Tipos de objetos // Tipos de objetos
#define ITEM_POINTS_1_DISK 1 #define ITEM_POINTS_1_DISK 1

View File

@@ -1,8 +1,10 @@
#ifndef JA_USESDLMIXER #ifndef JA_USESDLMIXER
#include "jail_audio.h" #include "jail_audio.h"
#include "stb_vorbis.c" #include <stdint.h> // for uint8_t
#include <SDL2/SDL.h> #include <stdio.h> // for NULL, fseek, fclose, fopen, fread, ftell, FILE
#include <stdio.h> #include <stdlib.h> // for free, malloc
#include "stb_vorbis.c" // for stb_vorbis_decode_memory
#define JA_MAX_SIMULTANEOUS_CHANNELS 5 #define JA_MAX_SIMULTANEOUS_CHANNELS 5

View File

@@ -1,12 +1,13 @@
#pragma once #pragma once
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h> // for SDL_AudioFormat
#include <SDL2/SDL_stdinc.h> // 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_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 }; 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_Init(const int freq, const SDL_AudioFormat format, const int channels);
void JA_Quit(); void JA_Quit();

View File

@@ -1,7 +1,10 @@
#ifndef NO_SHADERS #ifndef NO_SHADERS
#include "jshader.h"
#include <iostream> #include "jail_shader.h"
#include <SDL2/SDL_rect.h> // for SDL_Point
#include <stdlib.h> // for NULL, free, malloc, exit
#include <string.h> // for strncmp
#include <iostream> // for basic_ostream, char_traits, operator<<
#ifdef __APPLE__ #ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h" #include "CoreFoundation/CoreFoundation.h"
@@ -14,7 +17,6 @@
#endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3 #endif //!ESSENTIAL_GL_PRACTICES_SUPPORT_GL3
#else #else
#include <SDL2/SDL_opengl.h> #include <SDL2/SDL_opengl.h>
#include <SDL2/SDL_opengl_glext.h>
#endif #endif
namespace shader namespace shader

View File

@@ -2,7 +2,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_render.h> // for SDL_Texture
#include <SDL2/SDL_video.h> // for SDL_Window
// TIPS: // TIPS:
// ======================================================================= // =======================================================================

View File

@@ -1,6 +1,6 @@
#include "lang.h" #include "lang.h"
#include <iostream> #include <fstream> // for basic_ifstream, basic_istream, ifstream
#include <fstream> #include <vector> // for vector
namespace lang namespace lang
{ {

View File

@@ -1,8 +1,6 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string
#include <string>
#include <vector>
namespace lang namespace lang
{ {

View File

@@ -1,8 +1,17 @@
#include "logo.h" #include "logo.h"
#include "param.h" #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "options.h" #include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include "global_inputs.h" #include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_SIZE_CHANGED
#include <iostream> #include <string> // 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 // Constructor
Logo::Logo() Logo::Logo()

View File

@@ -1,15 +1,15 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include <vector> #include <SDL2/SDL_rect.h> // for SDL_Point
#include "asset.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "input.h" #include <vector> // for vector
#include "jail_audio.h" #include "utils.h" // for color_t
#include "lang.h" class Asset;
#include "screen.h" class Input;
#include "section.h" class Screen;
#include "sprite.h" class Sprite;
#include "utils.h" class Texture;
/* /*
Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el

View File

@@ -7,8 +7,9 @@ Actualizando a la versión "Arcade Edition" en 08/05/2024
*/ */
#include "director.h" #include <iostream> // for basic_ostream, char_traits, operator<<, cout
#include <stdio.h> #include <string> // for basic_string, operator<<, string
#include "director.h" // for Director
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View File

@@ -1,5 +1,10 @@
#include "manage_hiscore_table.h" #include "manage_hiscore_table.h"
#include <iostream> #include <SDL2/SDL_error.h> // for SDL_GetError
#include <SDL2/SDL_rwops.h> // for SDL_RWread, SDL_RWwrite, SDL_RWFromFile
#include <stdlib.h> // for free, malloc
#include <algorithm> // for sort
#include <iostream> // for basic_ostream, char_traits, operator<<
#include "utils.h" // for hiScoreEntry_t
// Constructor // Constructor
ManageHiScoreTable::ManageHiScoreTable(std::vector<hiScoreEntry_t> *table) ManageHiScoreTable::ManageHiScoreTable(std::vector<hiScoreEntry_t> *table)

View File

@@ -1,7 +1,8 @@
#pragma once #pragma once
#include <algorithm> #include <string> // for string
#include "utils.h" #include <vector> // for vector
struct hiScoreEntry_t;
/* /*
Esta clase sirve para añadir elementos hiScoreEntry_r a un vector (tabla), de manera Esta clase sirve para añadir elementos hiScoreEntry_r a un vector (tabla), de manera

View File

@@ -1,4 +1,5 @@
#include "movingsprite.h" #include "moving_sprite.h"
#include "texture.h" // for Texture
// Constructor // Constructor
MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture) MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture)

View File

@@ -1,7 +1,10 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect, SDL_Point
#include "sprite.h" #include <SDL2/SDL_render.h> // for SDL_RendererFlip
#include <SDL2/SDL_stdinc.h> // for Uint16
#include "sprite.h" // for Sprite
class Texture;
// Clase MovingSprite. Añade posicion y velocidad en punto flotante // Clase MovingSprite. Añade posicion y velocidad en punto flotante
class MovingSprite : public Sprite class MovingSprite : public Sprite

View File

@@ -1,8 +1,12 @@
#include "notify.h" #include "notify.h"
#include "options.h" #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <string> #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <stdio.h> #include <string> // for basic_string, char_traits, string
#include <iostream> #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 // Constructor
Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, std::string soundFile) Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, std::string soundFile)

View File

@@ -1,12 +1,14 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "jail_audio.h" #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "sprite.h" #include <string> // for basic_string, string
#include "text.h" #include <vector> // for vector
#include "texture.h" #include "utils.h" // for color_t
#include "utils.h" class Sprite;
#include <vector> class Text;
class Texture;
struct JA_Sound_t;
#ifndef NOTIFY_H #ifndef NOTIFY_H
#define NOTIFY_H #define NOTIFY_H

View File

@@ -1,8 +1,14 @@
#include "options.h" #include "options.h"
#include "screen.h" #include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton, SDL_C...
#include "lang.h" #include <SDL2/SDL_video.h> // for SDL_WINDOW_FULLSCREEN, SDL_WIND...
#include <iostream> #include <algorithm> // for max, min
#include <fstream> #include <fstream> // for char_traits, basic_ostream, ope...
#include <iostream> // for cout
#include <vector> // 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 // Variables
options_t options; options_t options;

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string
#include "utils.h" struct options_t;
// Variables // Variables
extern options_t options; extern options_t options;

View File

@@ -1,6 +1,7 @@
#include "param.h" #include "param.h"
#include <iostream> #include <fstream> // for char_traits, basic_ostream, basic_ifstream, basi...
#include <fstream> #include <iostream> // for cout
#include "utils.h" // for param_t, paramGame_t, zone_t, paramBalloon_t
param_t param; param_t param;

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string
#include "utils.h" struct param_t;
extern param_t param; extern param_t param;

View File

@@ -1,5 +1,12 @@
#include "player.h" #include "player.h"
#include "param.h" #include <SDL2/SDL_render.h> // for SDL_FLIP_HORIZONTAL, SDL_FLIP_NONE, SDL...
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <stdlib.h> // for rand
#include <algorithm> // 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 // Constructor
Player::Player(int id, float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations) Player::Player(int id, float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations)

View File

@@ -1,11 +1,12 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "animatedsprite.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "asset.h" #include <string> // for string, basic_string
#include "input.h" #include <vector> // for vector
#include "texture.h" #include "utils.h" // for circle_t
#include "utils.h" class AnimatedSprite;
class Texture;
// Estados del jugador // Estados del jugador
#define PLAYER_STATUS_WALKING_LEFT 0 #define PLAYER_STATUS_WALKING_LEFT 0

View File

@@ -1,5 +1,13 @@
#include "scoreboard.h" #include "scoreboard.h"
#include <math.h> #include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <math.h> // 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 // Constructor
Scoreboard::Scoreboard(SDL_Renderer *renderer) Scoreboard::Scoreboard(SDL_Renderer *renderer)

View File

@@ -1,12 +1,15 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Point, SDL_Rect
#include "asset.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "screen.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "sprite.h" #include <string> // for string, basic_string
#include "text.h" #include <vector> // for vector
#include "utils.h" #include "utils.h" // for color_t
#include "lang.h" class Asset;
class Sprite;
class Text;
class Texture;
// Defines // Defines
#define SCOREBOARD_LEFT_PANEL 0 #define SCOREBOARD_LEFT_PANEL 0

View File

@@ -1,13 +1,21 @@
#include "screen.h" #include "screen.h"
#include "options.h" #include <SDL2/SDL_events.h> // for SDL_DISABLE, SDL_ENABLE
#include <string> #include <SDL2/SDL_mouse.h> // for SDL_ShowCursor
#include <iostream> #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <fstream> #include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <streambuf> #include <algorithm> // for max, min
#include <fstream> // for basic_ifstream, ifstream
#include <iterator> // for istreambuf_iterator, operator!=
#include <string> // 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 #ifndef NO_SHADERS
#include "jshader.h" #include "jail_shader.h" // for init, render
#endif #endif
#include "dbgtxt.h"
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado // [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Screen *Screen::screen = nullptr; Screen *Screen::screen = nullptr;

View File

@@ -1,11 +1,15 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_blendmode.h> // for SDL_BlendMode
#include <vector> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include "asset.h" #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include "input.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "notify.h" #include <SDL2/SDL_video.h> // for SDL_Window
#include "utils.h" #include <string> // for basic_string, string
#include "utils.h" // for color_t
class Asset;
class Input;
class Notify;
#define SCREEN_FILTER_NEAREST 0 #define SCREEN_FILTER_NEAREST 0
#define SCREEN_FILTER_LINEAL 1 #define SCREEN_FILTER_LINEAL 1

View File

@@ -1,7 +1,5 @@
#pragma once #pragma once
#include <SDL2/SDL.h>
namespace section namespace section
{ {
// Secciones del programa // Secciones del programa

View File

@@ -1,4 +1,6 @@
#include "smartsprite.h" #include "smart_sprite.h"
#include "moving_sprite.h" // for MovingSprite
class Texture;
// Constructor // Constructor
SmartSprite::SmartSprite(Texture *texture) SmartSprite::SmartSprite(Texture *texture)

View File

@@ -1,9 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include "animated_sprite.h" // for AnimatedSprite
#include "animatedsprite.h" class Texture;
#include "utils.h"
#include <vector>
// Clase SmartSprite // Clase SmartSprite
class SmartSprite : public AnimatedSprite class SmartSprite : public AnimatedSprite

View File

@@ -1,4 +1,5 @@
#include "sprite.h" #include "sprite.h"
#include "texture.h" // for Texture
// Constructor // Constructor
Sprite::Sprite(int x, int y, int w, int h, Texture *texture) Sprite::Sprite(int x, int y, int w, int h, Texture *texture)

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect, SDL_Point
#include "texture.h" class Texture;
// Clase sprite // Clase sprite
class Sprite class Sprite

View File

@@ -1,7 +1,9 @@
#include "text.h" #include "text.h"
#include <iostream> #include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
#include <fstream> #include <iostream> // 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 // Llena una estructuta textFile_t desde un fichero
textFile_t LoadTextFile(std::string file, bool verbose) textFile_t LoadTextFile(std::string file, bool verbose)

View File

@@ -1,7 +1,11 @@
#pragma once #pragma once
#include "sprite.h" #include <SDL2/SDL_render.h> // for SDL_Renderer
#include <SDL2/SDL_stdinc.h> // for Uint8
#include <string> // for string
#include "utils.h" #include "utils.h"
class Sprite; // lines 6-6
class Texture; // lines 7-7
#define TXT_COLOR 1 #define TXT_COLOR 1
#define TXT_SHADOW 2 #define TXT_SHADOW 2

View File

@@ -1,12 +1,17 @@
#include "texture.h" #include "texture.h"
#include <SDL2/SDL_error.h> // for SDL_GetError
#include <SDL2/SDL_surface.h> // for SDL_CreateRGBSurfaceWithFormatFrom
#include <fcntl.h> // for SEEK_END, SEEK_SET
#include <stdio.h> // for fseek, fclose, fopen, fread, ftell, NULL
#include <stdlib.h> // for malloc, free, exit
#include <iostream> // for basic_ostream, operator<<, cout, endl
#include "gif.c" // for LoadGif, LoadPalette
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h" // for stbi_failure_reason, stbi_image_free
#include "gif.c"
#include <iostream>
// Constructor // Constructor
Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose) Texture::Texture(SDL_Renderer *renderer, std::string path)
{ {
// Copia punteros // Copia punteros
this->renderer = renderer; this->renderer = renderer;
@@ -29,7 +34,7 @@ Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose)
// .png // .png
if (extension == "png") if (extension == "png")
{ {
loadFromFile(path, verbose); loadFromFile(path);
} }
// .gif // .gif
@@ -53,7 +58,7 @@ Texture::~Texture()
} }
// Carga una imagen desde un fichero // 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); const std::string filename = path.substr(path.find_last_of("\\/") + 1);
int req_format = STBI_rgb_alpha; 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); unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
if (data == nullptr) 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); exit(1);
} }
else else
{ {
if (verbose) #ifdef VERBOSE
{ std::cout << "Image loaded: " << filename.c_str() << std::endl;
std::cout << "Image loaded: " << filename.c_str() << std::endl; #endif
}
} }
int depth, pitch; 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); SDL_Surface *loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom((void *)data, width, height, depth, pitch, pixel_format);
if (loadedSurface == nullptr) if (loadedSurface == nullptr)
{ {
if (verbose) #ifdef VERBOSE
{ std::cout << "Unable to load image " << path.c_str() << std::endl;
std::cout << "Unable to load image " << path.c_str() << std::endl; #endif
}
} }
else else
{ {
@@ -108,10 +113,9 @@ bool Texture::loadFromFile(std::string path, bool verbose)
newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface); newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface);
if (newTexture == nullptr) if (newTexture == nullptr)
{ {
if (verbose) #ifdef VERBOSE
{ std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl;
std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl; #endif
}
} }
else else
{ {
@@ -227,7 +231,7 @@ int Texture::getHeight()
// Recarga la textura // Recarga la textura
bool Texture::reLoad() bool Texture::reLoad()
{ {
return loadFromFile(path, renderer); return loadFromFile(path);
} }
// Obtiene la textura // Obtiene la textura

View File

@@ -1,9 +1,12 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_blendmode.h> // for SDL_BlendMode
#include <stdio.h> #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888, SDL_PixelF...
#include <string> #include <SDL2/SDL_rect.h> // for SDL_Point, SDL_Rect
#include <vector> #include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_FLIP_NONE, SDL_TEX...
#include <SDL2/SDL_stdinc.h> // for Uint8, Uint32, Uint16
#include <string> // for string, basic_string
#include <vector> // for vector
// Definiciones de tipos // Definiciones de tipos
struct surface_s struct surface_s
@@ -46,13 +49,13 @@ private:
public: public:
// Constructor // Constructor
Texture(SDL_Renderer *renderer, std::string path = "", bool verbose = false); Texture(SDL_Renderer *renderer, std::string path = "");
// Destructor // Destructor
~Texture(); ~Texture();
// Carga una imagen desde un fichero // Carga una imagen desde un fichero
bool loadFromFile(std::string path, bool verbose = false); bool loadFromFile(std::string path);
// Crea una textura en blanco // Crea una textura en blanco
bool createBlank(int width, int height, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING); bool createBlank(int width, int height, SDL_PixelFormatEnum format = SDL_PIXELFORMAT_RGBA8888, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING);

View File

@@ -1,6 +1,10 @@
#include "screen.h" #include "tiled_bg.h"
#include "sprite.h" #include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include "tiledbg.h" #include <SDL2/SDL_stdinc.h> // for SDL_sinf
#include <stdlib.h> // for rand
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
// Constructor // Constructor
Tiledbg::Tiledbg(std::string texturePath, SDL_Rect pos, int mode) Tiledbg::Tiledbg(std::string texturePath, SDL_Rect pos, int mode)

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include <string> // for string, basic_string
// Modos de funcionamiento para el tileado de fondo // Modos de funcionamiento para el tileado de fondo
#define TILED_MODE_CIRCLE 0 #define TILED_MODE_CIRCLE 0

View File

@@ -1,7 +1,26 @@
#include "global_inputs.h"
#include "options.h"
#include "param.h"
#include "title.h" #include "title.h"
#include <SDL2/SDL_keycode.h> // for SDLK_1, SDLK_2, SDLK_3
#include <SDL2/SDL_render.h> // for SDL_Renderer
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <string> // for allocator, basic_string, char_traits
#include <vector> // 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 // Constructor
Title::Title(JA_Music_t *music) Title::Title(JA_Music_t *music)

View File

@@ -1,25 +1,19 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_events.h> // for SDL_Event
#include "asset.h" #include <SDL2/SDL_stdinc.h> // for Uint32
#include "define_buttons.h" #include "utils.h" // for section_t
#include "fade.h" class Asset;
#include "game.h" class DefineButtons;
#include "game_logo.h" class Fade;
#include "hiscore_table.h" class GameLogo;
#include "input.h" class Input;
#include "instructions.h" class Screen;
#include "item.h" class Sprite;
#include "jail_audio.h" class Text;
#include "lang.h" class Texture;
#include "movingsprite.h" class Tiledbg;
#include "screen.h" struct JA_Music_t;
#include "section.h"
#include "smartsprite.h"
#include "sprite.h"
#include "text.h"
#include "tiledbg.h"
#include "utils.h"
// Textos // Textos
#define TEXT_COPYRIGHT "@2020,2024 JailDesigner" #define TEXT_COPYRIGHT "@2020,2024 JailDesigner"

View File

@@ -1,5 +1,7 @@
#include "utils.h" #include "utils.h"
#include <math.h> #include <stdlib.h> // for free, malloc
struct JA_Music_t;
struct JA_Sound_t;
// Colores // Colores
const color_t bgColor = {0x27, 0x27, 0x36}; const color_t bgColor = {0x27, 0x27, 0x36};

View File

@@ -1,10 +1,15 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton
#include <string> #include <SDL2/SDL_rect.h> // for SDL_Rect, SDL_Point
#include <vector> #include <SDL2/SDL_render.h> // for SDL_Renderer
#include "input.h" #include <SDL2/SDL_stdinc.h> // for Uint8, Uint32
#include "jail_audio.h" #include <stdint.h> // for int32_t
#include <string> // for string, basic_string
#include <vector> // for vector
#include "input.h" // for inputs_e
struct JA_Music_t;
struct JA_Sound_t;
// Dificultad del juego // Dificultad del juego
#define DIFFICULTY_EASY 0 #define DIFFICULTY_EASY 0

View File

@@ -1,4 +1,5 @@
#include "writer.h" #include "writer.h"
#include "text.h" // for Text
// Constructor // Constructor
Writer::Writer(Text *text) Writer::Writer(Text *text)

View File

@@ -1,8 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <string> // for string, basic_string
#include "sprite.h" class Text;
#include "text.h"
// Clase Writer. Pinta texto en pantalla letra a letra a partir de una cadena y un bitmap // Clase Writer. Pinta texto en pantalla letra a letra a partir de una cadena y un bitmap
class Writer class Writer

View File

@@ -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...