Afegides mes descripcions a les classes
Eliminat el punter a renderer de les classes-estat que faltava
This commit is contained in:
@@ -708,7 +708,7 @@ bool Director::saveConfigFile()
|
|||||||
{
|
{
|
||||||
file << "notification.posV=pos_top\n";
|
file << "notification.posV=pos_top\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file << "notification.posV=pos_bottom\n";
|
file << "notification.posV=pos_bottom\n";
|
||||||
@@ -718,12 +718,12 @@ bool Director::saveConfigFile()
|
|||||||
{
|
{
|
||||||
file << "notification.posH=pos_left\n";
|
file << "notification.posH=pos_left\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (options->notification.posH == pos_middle)
|
else if (options->notification.posH == pos_middle)
|
||||||
{
|
{
|
||||||
file << "notification.posH=pos_middle\n";
|
file << "notification.posH=pos_middle\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file << "notification.posH=pos_right\n";
|
file << "notification.posH=pos_right\n";
|
||||||
@@ -836,7 +836,7 @@ void Director::deleteMusics()
|
|||||||
// Ejecuta la seccion de juego con el logo
|
// Ejecuta la seccion de juego con el logo
|
||||||
void Director::runLogo()
|
void Director::runLogo()
|
||||||
{
|
{
|
||||||
logo = new Logo(renderer, screen, asset, input, param, section);
|
logo = new Logo(screen, asset, input, param, section);
|
||||||
logo->run();
|
logo->run();
|
||||||
delete logo;
|
delete logo;
|
||||||
}
|
}
|
||||||
@@ -844,7 +844,7 @@ void Director::runLogo()
|
|||||||
// Ejecuta la seccion de juego de la introducción
|
// Ejecuta la seccion de juego de la introducción
|
||||||
void Director::runIntro()
|
void Director::runIntro()
|
||||||
{
|
{
|
||||||
intro = new Intro(renderer, screen, asset, input, lang, param, section, getMusic(musics, "intro.ogg"));
|
intro = new Intro(screen, asset, input, lang, param, section, getMusic(musics, "intro.ogg"));
|
||||||
intro->run();
|
intro->run();
|
||||||
delete intro;
|
delete intro;
|
||||||
}
|
}
|
||||||
@@ -852,7 +852,7 @@ void Director::runIntro()
|
|||||||
// Ejecuta la seccion de juego con el titulo y los menus
|
// Ejecuta la seccion de juego con el titulo y los menus
|
||||||
void Director::runTitle()
|
void Director::runTitle()
|
||||||
{
|
{
|
||||||
title = new Title(screen, input, asset, options, lang, param, section, getMusic(musics, "title.ogg"));
|
title = new Title(screen, asset, input, options, lang, param, section, getMusic(musics, "title.ogg"));
|
||||||
title->run();
|
title->run();
|
||||||
delete title;
|
delete title;
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ void Director::runTitle()
|
|||||||
void Director::runGame()
|
void Director::runGame()
|
||||||
{
|
{
|
||||||
const int playerID = section->subsection == SUBSECTION_GAME_PLAY_1P ? 1 : 2;
|
const int playerID = section->subsection == SUBSECTION_GAME_PLAY_1P ? 1 : 2;
|
||||||
game = new Game(playerID, 0, renderer, screen, asset, lang, input, false, param, options, section, getMusic(musics, "playing.ogg"));
|
game = new Game(playerID, 0, screen, asset, lang, input, false, param, options, section, getMusic(musics, "playing.ogg"));
|
||||||
game->run();
|
game->run();
|
||||||
delete game;
|
delete game;
|
||||||
}
|
}
|
||||||
@@ -869,7 +869,7 @@ void Director::runGame()
|
|||||||
// Ejecuta la parte donde se muestra la tabla de puntuaciones
|
// Ejecuta la parte donde se muestra la tabla de puntuaciones
|
||||||
void Director::runHiScoreTable()
|
void Director::runHiScoreTable()
|
||||||
{
|
{
|
||||||
hiScoreTable = new HiScoreTable(renderer, screen, asset, input, lang, param, options, section);
|
hiScoreTable = new HiScoreTable(screen, asset, input, lang, param, options, section);
|
||||||
hiScoreTable->run();
|
hiScoreTable->run();
|
||||||
delete hiScoreTable;
|
delete hiScoreTable;
|
||||||
}
|
}
|
||||||
@@ -877,7 +877,7 @@ void Director::runHiScoreTable()
|
|||||||
// Ejecuta la parte donde se muestran las instrucciones
|
// Ejecuta la parte donde se muestran las instrucciones
|
||||||
void Director::runInstructions()
|
void Director::runInstructions()
|
||||||
{
|
{
|
||||||
instructions = new Instructions(renderer, screen, asset, input, lang, param, section);
|
instructions = new Instructions(screen, asset, input, lang, param, section);
|
||||||
instructions->run();
|
instructions->run();
|
||||||
delete instructions;
|
delete instructions;
|
||||||
}
|
}
|
||||||
@@ -886,7 +886,7 @@ void Director::runInstructions()
|
|||||||
void Director::runDemoGame()
|
void Director::runDemoGame()
|
||||||
{
|
{
|
||||||
const int playerID = (rand() % 2) + 1;
|
const int playerID = (rand() % 2) + 1;
|
||||||
demoGame = new Game(playerID, 0, renderer, screen, asset, lang, input, true, param, options, section, nullptr);
|
demoGame = new Game(playerID, 0, screen, asset, lang, input, true, param, options, section, nullptr);
|
||||||
demoGame->run();
|
demoGame->run();
|
||||||
delete demoGame;
|
delete demoGame;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
#define DEATH_COUNTER 350
|
#define DEATH_COUNTER 350
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section, JA_Music_t *music)
|
Game::Game(int playerID, int currentStage, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section, JA_Music_t *music)
|
||||||
{
|
{
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->lang = lang;
|
this->lang = lang;
|
||||||
@@ -15,6 +14,7 @@ Game::Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *scree
|
|||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
this->music = music;
|
this->music = music;
|
||||||
|
renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Pasa variables
|
// Pasa variables
|
||||||
this->demo.enabled = demo;
|
this->demo.enabled = demo;
|
||||||
@@ -967,9 +967,9 @@ void Game::renderPlayers()
|
|||||||
{
|
{
|
||||||
player->render();
|
player->render();
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
//SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
// SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||||
//const circle_t c = player->getCollider();
|
// const circle_t c = player->getCollider();
|
||||||
//DrawCircle(renderer, c.x, c.y, c.r);
|
// DrawCircle(renderer, c.x, c.y, c.r);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,32 @@
|
|||||||
// Valores para las variables asociadas a los objetos
|
// Valores para las variables asociadas a los objetos
|
||||||
#define TIME_STOPPED_COUNTER 300
|
#define TIME_STOPPED_COUNTER 300
|
||||||
|
|
||||||
|
/*
|
||||||
|
Esta clase gestiona un estado del programa. Se encarga de toda la parte en la
|
||||||
|
que se está jugando.
|
||||||
|
|
||||||
|
Tiene:
|
||||||
|
- Cacheadas todas las texturas y animaciones que usaran los diferentes objetos.
|
||||||
|
Mediante el método loadMedia() almacena en vectores todos los recursos
|
||||||
|
- Tiene vectores con objetos: jugadores, enemigos, balas, explosiones, objetos y otros (sprites con los puntos al coger objetos)
|
||||||
|
- Se encarga de comprobar las colisiones entre los diferentes objetos, los marca como deshabilitados si es el caso y
|
||||||
|
luego revisa los vectores para eliminar los objetos deshabilitados
|
||||||
|
|
||||||
|
Utiliza:
|
||||||
|
- Un objeto para dibujar el fondo animado
|
||||||
|
- Un objeto para dibujar el marcador
|
||||||
|
|
||||||
|
La clase comprueba el nivel de amenaza que hay en pantalla contando el número de enemigos y su peligrosidad y actua en consecuencia:
|
||||||
|
- Generando items
|
||||||
|
- Generando nuevas oleadas enemigas
|
||||||
|
|
||||||
|
Mientras haya un jugador activo siempre puede unirse un segundo jugador. Cada vez que un jugador muere
|
||||||
|
aparece una cuenta atras para permitirle continuar. Si la cuenta atras de ambos jugadores llega a cero,
|
||||||
|
el juego termina. Cuando ambos jugadores han finalizado, se permite introducir nombre para la tabla de records
|
||||||
|
adjuntando la máxima puntuación obtenida en la partida, solo en caso de que hayan conseguido superar la
|
||||||
|
puntuación mínima.
|
||||||
|
*/
|
||||||
|
|
||||||
// Clase Game
|
// Clase Game
|
||||||
class Game
|
class Game
|
||||||
{
|
{
|
||||||
@@ -428,7 +454,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Game(int playerID, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section, JA_Music_t *music);
|
Game(int playerID, int currentStage, Screen *screen, Asset *asset, Lang *lang, Input *input, bool demo, param_t *param, options_t *options, section_t *section, JA_Music_t *music);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Game();
|
~Game();
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section)
|
HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia punteros
|
// Copia punteros
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->input = input;
|
this->input = input;
|
||||||
@@ -13,6 +12,7 @@ HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset,
|
|||||||
this->section = section;
|
this->section = section;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->param = param;
|
this->param = param;
|
||||||
|
SDL_Renderer *renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Objetos
|
// Objetos
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
|
|||||||
@@ -13,12 +13,21 @@
|
|||||||
#include "fade.h"
|
#include "fade.h"
|
||||||
#include "background.h"
|
#include "background.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Esta clase gestiona un estado del programa. Se encarga de mostrar la tabla con las puntuaciones
|
||||||
|
más altas. Para ello utiliza un objeto que se encarga de pintar el fondo y una textura
|
||||||
|
sobre la que escribe las puntuacions. Esta textura se recorre modificando la ventana de vista
|
||||||
|
para dar el efecto de que la textura se mueve sobre la pantalla.
|
||||||
|
|
||||||
|
Para mejorar la legibilidad de los textos, el objeto que dibuja el fondo es capaz de modificar
|
||||||
|
su atenuación.
|
||||||
|
*/
|
||||||
|
|
||||||
// Clase HiScoreTable
|
// Clase HiScoreTable
|
||||||
class HiScoreTable
|
class HiScoreTable
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
||||||
@@ -69,7 +78,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section);
|
HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, options_t *options, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~HiScoreTable();
|
~HiScoreTable();
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section)
|
Instructions::Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->input = input;
|
this->input = input;
|
||||||
this->lang = lang;
|
this->lang = lang;
|
||||||
this->param = param;
|
this->param = param;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
SDL_Renderer *renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Crea objetos
|
// Crea objetos
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
@@ -181,7 +181,7 @@ void Instructions::fillTexture()
|
|||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor2, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor2, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
const int anchor3 = anchor2 + spacePostHeader;
|
const int anchor3 = anchor2 + spacePostHeader;
|
||||||
//const int anchor4 = anchor3 + ((param->itemSize + text->getCharacterSize()) / 2);
|
// const int anchor4 = anchor3 + ((param->itemSize + text->getCharacterSize()) / 2);
|
||||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 0, lang->getText(17), shdwTxtColor);
|
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 0, lang->getText(17), shdwTxtColor);
|
||||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 1, lang->getText(18), shdwTxtColor);
|
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 1, lang->getText(18), shdwTxtColor);
|
||||||
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 2, lang->getText(19), shdwTxtColor);
|
text->writeShadowed(anchorItem + despX, anchor3 + spaceBetweenItemLines * 2, lang->getText(19), shdwTxtColor);
|
||||||
|
|||||||
@@ -13,12 +13,24 @@
|
|||||||
#include "tiledbg.h"
|
#include "tiledbg.h"
|
||||||
#include "fade.h"
|
#include "fade.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Esta clase gestiona un estado del programa. Se encarga de poner en pantalla
|
||||||
|
un texto explicativo para entender como se juega.
|
||||||
|
|
||||||
|
Ademas muestra algunos items y explica para qué sirven.
|
||||||
|
|
||||||
|
Utiliza dos texturas de apoyo, una con el texto ya escrito y otra donde se combina
|
||||||
|
tanto el texto de la primera textura como los sprites de los items.
|
||||||
|
|
||||||
|
Finalmente, una ventana recorre la textura para dar el efecto de que todo se desplaza
|
||||||
|
por la pantalla sobre el mosaico de fondo (gestionado por el correspondiente objeto)
|
||||||
|
*/
|
||||||
|
|
||||||
// Clase Instructions
|
// Clase Instructions
|
||||||
class Instructions
|
class Instructions
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
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<Texture *> itemTextures; // Vector con las texturas de los items
|
std::vector<Texture *> itemTextures; // Vector con las texturas de los items
|
||||||
std::vector<Sprite *> sprites; // Vector con los sprites de los items
|
std::vector<Sprite *> sprites; // Vector con los sprites de los items
|
||||||
@@ -72,7 +84,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section);
|
Instructions(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Instructions();
|
~Instructions();
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#include "intro.h"
|
#include "intro.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
||||||
{
|
{
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->lang = lang;
|
this->lang = lang;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
@@ -12,6 +11,7 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
|
|||||||
this->param = param;
|
this->param = param;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
this->music = music;
|
this->music = music;
|
||||||
|
SDL_Renderer *renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Reserva memoria para los objetos
|
// Reserva memoria para los objetos
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
@@ -146,8 +146,6 @@ Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input,
|
|||||||
Intro::~Intro()
|
Intro::~Intro()
|
||||||
{
|
{
|
||||||
delete eventHandler;
|
delete eventHandler;
|
||||||
|
|
||||||
texture->unload();
|
|
||||||
delete texture;
|
delete texture;
|
||||||
|
|
||||||
for (auto bitmap : bitmaps)
|
for (auto bitmap : bitmaps)
|
||||||
|
|||||||
@@ -12,12 +12,16 @@
|
|||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Esta clase gestiona un estado del programa. Se encarga de mostrar la secuencia
|
||||||
|
de introducción
|
||||||
|
*/
|
||||||
|
|
||||||
// Clase Intro
|
// Clase Intro
|
||||||
class Intro
|
class Intro
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Texture *texture; // Textura con los graficos
|
Texture *texture; // Textura con los graficos
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
@@ -56,7 +60,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Intro();
|
~Intro();
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, param_t *param, section_t *section)
|
Logo::Logo(Screen *screen, Asset *asset, Input *input, param_t *param, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->input = input;
|
this->input = input;
|
||||||
this->param = param;
|
this->param = param;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
SDL_Renderer *renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Reserva memoria para los punteros
|
// Reserva memoria para los punteros
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
|
|||||||
@@ -10,11 +10,19 @@
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el
|
||||||
|
logo de "JAILGAMES" utilizando un sencillo efecto consistente en generar un sprite por
|
||||||
|
cada linea del bitmap que forma la palabra "JAILGAMES". Posteriormente realiza una
|
||||||
|
modulación de color sobre la textura para simular un fade to black al estilo
|
||||||
|
ZX Spectrum
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Clase Logo
|
||||||
class Logo
|
class Logo
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
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 con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
Input *input; // Objeto pata gestionar la entrada
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
@@ -60,7 +68,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, param_t *param, section_t *section);
|
Logo(Screen *screen, Asset *asset, Input *input, param_t *param, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Logo();
|
~Logo();
|
||||||
|
|||||||
@@ -4,12 +4,11 @@
|
|||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
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
|
||||||
que la tabla siempre está ordenada. Además también tiene un método para dejar la tabla
|
que la tabla siempre está ordenada. Además también tiene un método para dejar la tabla
|
||||||
con sus valores iniciales
|
con sus valores iniciales
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Clase ManageHiScoreTable
|
// Clase ManageHiScoreTable
|
||||||
class ManageHiScoreTable
|
class ManageHiScoreTable
|
||||||
{
|
{
|
||||||
@@ -19,7 +18,7 @@ private:
|
|||||||
|
|
||||||
// Ordena la tabla
|
// Ordena la tabla
|
||||||
void sort();
|
void sort();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ManageHiScoreTable(std::vector<hiScoreEntry_t> *table);
|
ManageHiScoreTable(std::vector<hiScoreEntry_t> *table);
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
#define TILED_MODE_STATIC 3
|
#define TILED_MODE_STATIC 3
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Esta clase dibuja un tileado de fondo. Para ello se sirve de una textura "canvas", que rellena con los tiles.
|
Esta clase dibuja un tileado de fondo. Para ello se sirve de una textura "canvas", que rellena con los tiles.
|
||||||
El rectangulo "window" recorre la textura de diferentes formas para generar el efecto de movimiento de la
|
El rectangulo "window" recorre la textura de diferentes formas para generar el efecto de movimiento de la
|
||||||
textura en pantalla
|
textura en pantalla
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Clase Tiledbg
|
// Clase Tiledbg
|
||||||
@@ -31,7 +31,7 @@ private:
|
|||||||
// Variables
|
// Variables
|
||||||
SDL_Rect pos; // Posición y tamaña del mosaico
|
SDL_Rect pos; // Posición y tamaña del mosaico
|
||||||
int counter; // Contador
|
int counter; // Contador
|
||||||
int mode; // Tipo de movimiento del mosaico
|
int mode; // Tipo de movimiento del mosaico
|
||||||
float sin[360]; // Vector con los valores del seno precalculados
|
float sin[360]; // Vector con los valores del seno precalculados
|
||||||
int tileWidth; // Ancho del tile
|
int tileWidth; // Ancho del tile
|
||||||
int tileHeight; // Alto del tile
|
int tileHeight; // Alto del tile
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "title.h"
|
#include "title.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Title::Title(Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music)
|
||||||
{
|
{
|
||||||
// Copia las direcciones de los punteros y objetos
|
// Copia las direcciones de los punteros y objetos
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
@@ -245,7 +245,7 @@ void Title::checkInput()
|
|||||||
if (index)
|
if (index)
|
||||||
{
|
{
|
||||||
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
if (section->subsection == SUBSECTION_TITLE_2 || ALLOW_TITLE_ANIMATION_SKIP)
|
||||||
{// No se puede empezar a jugar durante la animación del titulo
|
{ // No se puede empezar a jugar durante la animación del titulo
|
||||||
fade->activate();
|
fade->activate();
|
||||||
postFade = index;
|
postFade = index;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,18 +28,18 @@
|
|||||||
#define ALLOW_TITLE_ANIMATION_SKIP false
|
#define ALLOW_TITLE_ANIMATION_SKIP false
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Esta clase gestiona un estado del programa. Se encarga de la parte del titulo o menu
|
Esta clase gestiona un estado del programa. Se encarga de la parte del titulo o menu
|
||||||
que sirve para empezar a jugar. Utiliza otras clases para:
|
que sirve para empezar a jugar. Utiliza otras clases para:
|
||||||
- Mostrar el logo del juego
|
- Mostrar el logo del juego
|
||||||
- Dibujar el tileado de fondo
|
- Dibujar el tileado de fondo
|
||||||
- Redifinir los botones de los mandos de juego
|
- Redifinir los botones de los mandos de juego
|
||||||
|
|
||||||
Esta clase tiene dos estados:
|
Esta clase tiene dos estados:
|
||||||
- El titulo está animandose, con el fondo estático
|
- El titulo está animandose, con el fondo estático
|
||||||
- El titulo ya está en su sitio y el fondo se está animando
|
- El titulo ya está en su sitio y el fondo se está animando
|
||||||
|
|
||||||
Por razones de diseño, no se permite saltarse la animación del titulo, aunque es
|
Por razones de diseño, no se permite saltarse la animación del titulo, aunque es
|
||||||
configurable mediante un define
|
configurable mediante un define
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Clase Title
|
// Clase Title
|
||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Title();
|
~Title();
|
||||||
|
|||||||
Reference in New Issue
Block a user