Movidos los archivos de clases comunes a la carpeta common

This commit is contained in:
2022-10-19 09:38:38 +02:00
parent cf357560b2
commit b07baa4669
43 changed files with 927 additions and 928 deletions

View File

@@ -1,16 +1,17 @@
executable = coffee_crisis executable = coffee_crisis
source = source/*.cpp source/common/*.cpp
windows: windows:
@echo off @echo off
if not exist bin\ (mkdir bin) if not exist bin\ (mkdir bin)
g++ -std=c++11 -Wall -O2 source/*.cpp -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o bin/$(executable).exe g++ $(source) -std=c++11 -Wall -O2 -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o bin/$(executable).exe
strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded
macos: macos:
mkdir -p bin mkdir -p bin
g++ source/*.cpp -std=c++11 -Wall -O2 -lSDL2 -ffunction-sections -fdata-sections -o bin/$(executable)_macos g++ $(source) -std=c++11 -Wall -O2 -lSDL2 -ffunction-sections -fdata-sections -o bin/$(executable)_macos
linux: linux:
mkdir -p bin mkdir -p bin
g++ source/*.cpp -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o bin/$(executable)_linux
strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded strip -s -R .comment -R .gnu.version bin/$(executable)_linux --strip-unneeded
opendingux: opendingux:
mkdir -p bin mkdir -p bin

View File

@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/utils.h"
#include "animatedsprite.h" #include "common/animatedsprite.h"
#include <vector> #include <vector>
#include <sstream> #include <sstream>
@@ -86,7 +86,7 @@ private:
std::vector<float> h; // Vector con los valores de zoom para el alto del globo std::vector<float> h; // Vector con los valores de zoom para el alto del globo
}; };
// Objetos // Objetos y punteros
AnimatedSprite *sprite; // Sprite del objeto globo AnimatedSprite *sprite; // Sprite del objeto globo
// Variables // Variables

View File

@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/utils.h"
#include "sprite.h" #include "common/sprite.h"
#ifndef BULLET_H #ifndef BULLET_H
#define BULLET_H #define BULLET_H
@@ -20,7 +20,7 @@
class Bullet class Bullet
{ {
private: private:
// Objetos // Objetos y punteros
Sprite *sprite; // Sprite con los graficos y métodos de pintado Sprite *sprite; // Sprite con los graficos y métodos de pintado
// Variables // Variables

View File

@@ -1,4 +1,4 @@
#include "const.h" #include "../const.h"
#include "menu.h" #include "menu.h"
// Constructor // Constructor

View File

@@ -68,7 +68,7 @@ private:
int a; // Cantidad de transparencia para el rectangulo del selector int a; // Cantidad de transparencia para el rectangulo del selector
}; };
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // Puntero al renderizador de la ventana SDL_Renderer *renderer; // Puntero al renderizador de la ventana
Text *text; // Texto para poder escribir los items del menu Text *text; // Texto para poder escribir los items del menu
Input *input; // Gestor de eventos de entrada de teclado o gamepad Input *input; // Gestor de eventos de entrada de teclado o gamepad

View File

@@ -1,4 +1,4 @@
#include "const.h" #include "../const.h"
#include "movingsprite.h" #include "movingsprite.h"
// Constructor // Constructor

View File

@@ -1,4 +1,4 @@
#include "const.h" #include "../const.h"
#include "smartsprite.h" #include "smartsprite.h"
// Constructor // Constructor

View File

@@ -22,7 +22,7 @@ private:
int w; int w;
}; };
// Objetos // Objetos y punteros
Sprite *sprite; // Objeto con los graficos para el texto Sprite *sprite; // Objeto con los graficos para el texto
LTexture *texture; // Textura con los bitmaps del texto LTexture *texture; // Textura con los bitmaps del texto

View File

@@ -1,4 +1,4 @@
#include "const.h" #include "../const.h"
#include "writer.h" #include "writer.h"
// Constructor // Constructor

View File

@@ -11,7 +11,7 @@
class Writer class Writer
{ {
private: private:
// Objetos // Objetos y punteros
Text *text; // Objeto encargado de escribir el texto Text *text; // Objeto encargado de escribir el texto
// Variables // Variables

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/utils.h"
#include "lang.h" #include "lang.h"
#ifndef CONST_H #ifndef CONST_H

View File

@@ -1,6 +1,6 @@
#include "const.h" #include "const.h"
#include "director.h" #include "director.h"
#include "utils.h" #include "common/utils.h"
#include <iostream> #include <iostream>
#include <string> #include <string>

View File

@@ -1,27 +1,27 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h"
#include "balloon.h" #include "balloon.h"
#include "bullet.h" #include "bullet.h"
#include "common/asset.h"
#include "common/input.h"
#include "common/jail_audio.h"
#include "common/menu.h"
#include "common/movingsprite.h"
#include "common/screen.h"
#include "common/smartsprite.h"
#include "common/sprite.h"
#include "common/text.h"
#include "common/utils.h"
#include "common/writer.h"
#include "const.h" #include "const.h"
#include "fade.h" #include "fade.h"
#include "game.h" #include "game.h"
#include "input.h"
#include "intro.h" #include "intro.h"
#include "item.h" #include "item.h"
#include "jail_audio.h"
#include "logo.h" #include "logo.h"
#include "menu.h"
#include "movingsprite.h"
#include "player.h" #include "player.h"
#include "screen.h"
#include "smartsprite.h"
#include "sprite.h"
#include "text.h"
#include "title.h" #include "title.h"
#include "utils.h"
#include "writer.h"
#ifndef DIRECTOR_H #ifndef DIRECTOR_H
#define DIRECTOR_H #define DIRECTOR_H
@@ -29,11 +29,10 @@
// Textos // Textos
#define WINDOW_CAPTION "Coffee Crisis" #define WINDOW_CAPTION "Coffee Crisis"
// Clase Director
class Director class Director
{ {
private: private:
// Objetos // Objetos y punteros
SDL_Window *window; // La ventana donde dibujamos SDL_Window *window; // La ventana donde dibujamos
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "ltexture.h" #include "common/ltexture.h"
#ifndef FADE_H #ifndef FADE_H
#define FADE_H #define FADE_H

View File

@@ -1,23 +1,23 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include "balloon.h" #include "balloon.h"
#include "bullet.h" #include "bullet.h"
#include "const.h" #include "const.h"
#include "fade.h" #include "fade.h"
#include "input.h" #include "common/input.h"
#include "item.h" #include "item.h"
#include "jail_audio.h" #include "common/jail_audio.h"
#include "menu.h" #include "common/menu.h"
#include "movingsprite.h" #include "common/movingsprite.h"
#include "player.h" #include "player.h"
#include "screen.h" #include "common/screen.h"
#include "smartsprite.h" #include "common/smartsprite.h"
#include "sprite.h" #include "common/sprite.h"
#include "text.h" #include "common/text.h"
#include "utils.h" #include "common/utils.h"
#include "writer.h" #include "common/writer.h"
#include <iostream> #include <iostream>
#ifndef GAME_H #ifndef GAME_H
@@ -114,7 +114,7 @@ private:
demoKeys_t dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo demoKeys_t dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo
}; };
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla
Asset *asset; // Objeto que gestiona todos los ficheros de recursos Asset *asset; // Objeto que gestiona todos los ficheros de recursos

View File

@@ -1,13 +1,13 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include "const.h" #include "const.h"
#include "jail_audio.h" #include "common/jail_audio.h"
#include "screen.h" #include "common/screen.h"
#include "sprite.h" #include "common/sprite.h"
#include "text.h" #include "common/text.h"
#include "utils.h" #include "common/utils.h"
#ifndef INSTRUCTIONS_H #ifndef INSTRUCTIONS_H
#define INSTRUCTIONS_H #define INSTRUCTIONS_H
@@ -22,7 +22,7 @@ enum mode_e
class Instructions class Instructions
{ {
private: private:
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla
std::vector<LTexture *> itemTextures; // Vector con las texturas de los items std::vector<LTexture *> itemTextures; // Vector con las texturas de los items

View File

@@ -1,13 +1,13 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include "const.h" #include "const.h"
#include "jail_audio.h" #include "common/jail_audio.h"
#include "screen.h" #include "common/screen.h"
#include "smartsprite.h" #include "common/smartsprite.h"
#include "utils.h" #include "common/utils.h"
#include "writer.h" #include "common/writer.h"
#include <vector> #include <vector>
#ifndef INTRO_H #ifndef INTRO_H
@@ -17,7 +17,7 @@
class Intro class Intro
{ {
private: private:
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla
LTexture *texture; // Textura con los graficos LTexture *texture; // Textura con los graficos

View File

@@ -1,8 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "animatedsprite.h" #include "common/animatedsprite.h"
#include "utils.h" #include "common/utils.h"
#ifndef ITEM_H #ifndef ITEM_H
#define ITEM_H #define ITEM_H
@@ -19,7 +19,7 @@
class Item class Item
{ {
private: private:
// Objetos // Objetos y punteros
AnimatedSprite *sprite; // Sprite con los graficos del objeto AnimatedSprite *sprite; // Sprite con los graficos del objeto
// Variables // Variables

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include <string> #include <string>
#ifndef LANG_H #ifndef LANG_H

View File

@@ -1,12 +1,12 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include "const.h" #include "const.h"
#include "jail_audio.h" #include "common/jail_audio.h"
#include "screen.h" #include "common/screen.h"
#include "sprite.h" #include "common/sprite.h"
#include "utils.h" #include "common/utils.h"
#ifndef LOGO_H #ifndef LOGO_H
#define LOGO_H #define LOGO_H
@@ -15,7 +15,7 @@
class Logo class Logo
{ {
private: private:
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla
Asset *asset; // Objeto que gestiona todos los ficheros de recursos Asset *asset; // Objeto que gestiona todos los ficheros de recursos

View File

@@ -1,11 +1,11 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "utils.h" #include "common/utils.h"
#include "input.h" #include "common/input.h"
#include "asset.h" #include "common/asset.h"
#include "ltexture.h" #include "common/ltexture.h"
#include "animatedsprite.h" #include "common/animatedsprite.h"
#ifndef PLAYER_H #ifndef PLAYER_H
#define PLAYER_H #define PLAYER_H
@@ -31,7 +31,7 @@
class Player class Player
{ {
private: private:
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
AnimatedSprite *headSprite; // Sprite para dibujar la cabeza AnimatedSprite *headSprite; // Sprite para dibujar la cabeza
AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo

View File

@@ -1,21 +1,21 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h" #include "common/asset.h"
#include "common/input.h"
#include "common/jail_audio.h"
#include "common/menu.h"
#include "common/movingsprite.h"
#include "common/screen.h"
#include "common/smartsprite.h"
#include "common/sprite.h"
#include "common/text.h"
#include "common/utils.h"
#include "const.h" #include "const.h"
#include "fade.h" #include "fade.h"
#include "game.h" #include "game.h"
#include "input.h"
#include "instructions.h" #include "instructions.h"
#include "item.h" #include "item.h"
#include "jail_audio.h"
#include "menu.h"
#include "movingsprite.h"
#include "screen.h"
#include "smartsprite.h"
#include "sprite.h"
#include "text.h"
#include "utils.h"
#ifndef TITLE_H #ifndef TITLE_H
#define TITLE_H #define TITLE_H
@@ -29,7 +29,6 @@
// Cantidad de eventos de la pantalla de titulo // Cantidad de eventos de la pantalla de titulo
#define TITLE_TOTAL_EVENTS 2 #define TITLE_TOTAL_EVENTS 2
// Clase Title
class Title class Title
{ {
private: private:
@@ -42,7 +41,7 @@ private:
bool keyPressed; // Variable para evitar la repetición de teclas en los menus bool keyPressed; // Variable para evitar la repetición de teclas en los menus
}; };
// Objetos // Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Screen *screen; // Objeto encargado de dibujar en pantalla Screen *screen; // Objeto encargado de dibujar en pantalla
Asset *asset; // Objeto que gestiona todos los ficheros de recursos Asset *asset; // Objeto que gestiona todos los ficheros de recursos