forked from jaildesigner-jailgames/jaildoctors_dilemma
Commit para seguir programando en WSL
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->resource = resource;
|
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
|
this->resource = resource;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
|
this->input = input;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/animatedsprite.h"
|
#include "common/animatedsprite.h"
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -30,13 +31,14 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
Text *text; // Objeto para escribir texto en pantalla
|
Text *text; // Objeto para escribir texto en pantalla
|
||||||
SDL_Texture *textTexture; // Textura para dibujar el texto
|
SDL_Texture *textTexture; // Textura para dibujar el texto
|
||||||
SDL_Texture *coverTexture; // Textura para cubrir el texto
|
SDL_Texture *coverTexture; // Textura para cubrir el texto
|
||||||
AnimatedSprite *sprite; // Sprite para el brillo del corazón
|
AnimatedSprite *sprite; // Sprite para el brillo del corazón
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
section_t *section; // Estado del bucle principal para saber si continua o se sale
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int counter; // Contador
|
int counter; // Contador
|
||||||
@@ -69,7 +71,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Credits();
|
~Credits();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section, Debug *debug)
|
Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section, Debug *debug)
|
||||||
{
|
{
|
||||||
// Inicia algunas variables
|
// Inicia algunas variables
|
||||||
board.iniClock = SDL_GetTicks();
|
board.iniClock = SDL_GetTicks();
|
||||||
@@ -18,17 +18,18 @@ Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
|||||||
currentRoom = rooms[roomIndex];
|
currentRoom = rooms[roomIndex];
|
||||||
|
|
||||||
// Copia los punteros
|
// Copia los punteros
|
||||||
this->resource = resource;
|
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
this->asset = asset;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->debug = debug;
|
this->resource = resource;
|
||||||
|
this->asset = asset;
|
||||||
|
this->input = input;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
this->debug = debug;
|
||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
itemTracker = new ItemTracker();
|
itemTracker = new ItemTracker();
|
||||||
scoreboard = new ScoreBoard(renderer, resource, asset, options, &board);
|
scoreboard = new ScoreBoard(renderer, resource, asset, input, options, &board);
|
||||||
room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug);
|
room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug);
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/animatedsprite.h"
|
#include "common/animatedsprite.h"
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
@@ -29,12 +30,13 @@ private:
|
|||||||
Room *room; // Objeto encargado de gestionar cada habitación del juego
|
Room *room; // Objeto encargado de gestionar cada habitación del juego
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
Text *text; // Objeto para los textos del juego
|
Text *text; // Objeto para los textos del juego
|
||||||
ScoreBoard *scoreboard; // Objeto encargado de gestionar el marcador
|
ScoreBoard *scoreboard; // Objeto encargado de gestionar el marcador
|
||||||
ItemTracker *itemTracker; // Lleva el control de los objetos recogidos
|
ItemTracker *itemTracker; // Lleva el control de los objetos recogidos
|
||||||
Debug *debug; // Objeto para gestionar la información de debug
|
Debug *debug; // Objeto para gestionar la información de debug
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
section_t *section; // Seccion actual dentro del juego
|
section_t *section; // Seccion actual dentro del juego
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
|
||||||
@@ -75,7 +77,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section, Debug *debug);
|
Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section, Debug *debug);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Demo();
|
~Demo();
|
||||||
|
|||||||
@@ -1708,7 +1708,7 @@ void Director::runLogo()
|
|||||||
std::cout << "\n* SECTION: LOGO" << std::endl;
|
std::cout << "\n* SECTION: LOGO" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
logo = new Logo(renderer, screen, resource, asset, options, section);
|
logo = new Logo(renderer, screen, resource, asset, input, options, section);
|
||||||
logo->run();
|
logo->run();
|
||||||
delete logo;
|
delete logo;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1722,7 +1722,7 @@ void Director::runIntro()
|
|||||||
std::cout << "\n* SECTION: INTRO" << std::endl;
|
std::cout << "\n* SECTION: INTRO" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
intro = new Intro(renderer, screen, resource, asset, options, section);
|
intro = new Intro(renderer, screen, resource, asset, input, options, section);
|
||||||
intro->run();
|
intro->run();
|
||||||
delete intro;
|
delete intro;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1740,7 +1740,7 @@ void Director::runTitle()
|
|||||||
JA_PlayMusic(music);
|
JA_PlayMusic(music);
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
title = new Title(renderer, screen, resource, asset, options, section);
|
title = new Title(renderer, screen, resource, asset, input, options, section);
|
||||||
title->run();
|
title->run();
|
||||||
delete title;
|
delete title;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1754,7 +1754,7 @@ void Director::runCredits()
|
|||||||
std::cout << "\n* SECTION: CREDITS" << std::endl;
|
std::cout << "\n* SECTION: CREDITS" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
credits = new Credits(renderer, screen, resource, asset, options, section);
|
credits = new Credits(renderer, screen, resource, asset, input, options, section);
|
||||||
credits->run();
|
credits->run();
|
||||||
delete credits;
|
delete credits;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1768,7 +1768,7 @@ void Director::runDemo()
|
|||||||
std::cout << "\n* SECTION: DEMO" << std::endl;
|
std::cout << "\n* SECTION: DEMO" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
demo = new Demo(renderer, screen, resource, asset, options, section, debug);
|
demo = new Demo(renderer, screen, resource, asset, input, options, section, debug);
|
||||||
demo->run();
|
demo->run();
|
||||||
delete demo;
|
delete demo;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1782,7 +1782,7 @@ void Director::runEnterID()
|
|||||||
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
|
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
|
||||||
}
|
}
|
||||||
// loadResources(section);
|
// loadResources(section);
|
||||||
enterID = new EnterID(renderer, screen, asset, options, section);
|
enterID = new EnterID(renderer, screen, asset, input, options, section);
|
||||||
enterID->run();
|
enterID->run();
|
||||||
delete enterID;
|
delete enterID;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1796,7 +1796,7 @@ void Director::runEnding()
|
|||||||
std::cout << "\n* SECTION: ENDING" << std::endl;
|
std::cout << "\n* SECTION: ENDING" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
ending = new Ending(renderer, screen, resource, asset, options, section);
|
ending = new Ending(renderer, screen, resource, asset, input, options, section);
|
||||||
ending->run();
|
ending->run();
|
||||||
delete ending;
|
delete ending;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1810,7 +1810,7 @@ void Director::runEnding2()
|
|||||||
std::cout << "\n* SECTION: ENDING2" << std::endl;
|
std::cout << "\n* SECTION: ENDING2" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
ending2 = new Ending2(renderer, screen, resource, asset, options, section);
|
ending2 = new Ending2(renderer, screen, resource, asset, input, options, section);
|
||||||
ending2->run();
|
ending2->run();
|
||||||
delete ending2;
|
delete ending2;
|
||||||
resource->free();
|
resource->free();
|
||||||
@@ -1824,7 +1824,7 @@ void Director::runGameOver()
|
|||||||
std::cout << "\n* SECTION: GAME OVER" << std::endl;
|
std::cout << "\n* SECTION: GAME OVER" << std::endl;
|
||||||
}
|
}
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
gameOver = new GameOver(renderer, screen, resource, asset, options, section);
|
gameOver = new GameOver(renderer, screen, resource, asset, input, options, section);
|
||||||
gameOver->run();
|
gameOver->run();
|
||||||
delete gameOver;
|
delete gameOver;
|
||||||
resource->free();
|
resource->free();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -54,6 +55,7 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
Text *text; // Objeto para escribir texto en pantalla
|
Text *text; // Objeto para escribir texto en pantalla
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/animatedsprite.h"
|
#include "common/animatedsprite.h"
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -25,6 +26,7 @@ private:
|
|||||||
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_Renderer *renderer; // El renderizador de la ventana
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
Text *text; // Objeto para escribir texto en pantalla
|
Text *text; // Objeto para escribir texto en pantalla
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
std::vector<AnimatedSprite *> sprites; // Vector con todos los sprites a dibujar
|
std::vector<AnimatedSprite *> sprites; // Vector con todos los sprites a dibujar
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
|||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
cheevos = new Cheevos(screen, options, asset->get("cheevos.bin"));
|
cheevos = new Cheevos(screen, options, asset->get("cheevos.bin"));
|
||||||
scoreboard = new ScoreBoard(renderer, resource, asset, options, &board);
|
scoreboard = new ScoreBoard(renderer, resource, asset, input, options, &board);
|
||||||
itemTracker = new ItemTracker();
|
itemTracker = new ItemTracker();
|
||||||
roomTracker = new RoomTracker();
|
roomTracker = new RoomTracker();
|
||||||
room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug);
|
room = new Room(resource->getRoom(currentRoom), renderer, screen, asset, options, itemTracker, &board.items, false, debug);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/animatedsprite.h"
|
#include "common/animatedsprite.h"
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -23,6 +24,7 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
options_t *options; // Puntero a las opciones del juego
|
options_t *options; // Puntero a las opciones del juego
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
Text *text; // Objeto para escribir texto en pantalla
|
Text *text; // Objeto para escribir texto en pantalla
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
#include "intro.h"
|
#include "intro.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
|
this->input = input;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -24,6 +25,7 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
Texture *loadingScreenTexture1; // Textura con la pantalla de carga en blanco y negro
|
Texture *loadingScreenTexture1; // Textura con la pantalla de carga en blanco y negro
|
||||||
Texture *loadingScreenTexture2; // Textura con la pantalla de carga en color
|
Texture *loadingScreenTexture2; // Textura con la pantalla de carga en color
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
@@ -71,7 +73,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
Intro(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Intro();
|
~Intro();
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
|
this->input = input;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
|
||||||
@@ -80,56 +81,57 @@ void Logo::checkEventHandler()
|
|||||||
section->name = SECTION_PROG_QUIT;
|
section->name = SECTION_PROG_QUIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Comprueba las teclas que se han pulsado
|
// Comprueba las entradas
|
||||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
|
void Logo::checkInput()
|
||||||
{
|
{
|
||||||
switch (eventHandler->key.keysym.scancode)
|
|
||||||
{
|
|
||||||
case SDL_SCANCODE_ESCAPE:
|
|
||||||
section->name = SECTION_PROG_QUIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDL_SCANCODE_B:
|
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||||
screen->switchBorder();
|
{
|
||||||
resource->reLoadTextures();
|
section->name = SECTION_PROG_TITLE;
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F:
|
else if (input->checkInput(input_toggle_border, REPEAT_FALSE))
|
||||||
screen->switchVideoMode();
|
{
|
||||||
resource->reLoadTextures();
|
screen->switchBorder();
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F1:
|
else if (input->checkInput(input_video_mode, REPEAT_FALSE))
|
||||||
screen->setWindowSize(1);
|
{
|
||||||
resource->reLoadTextures();
|
screen->switchVideoMode();
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F2:
|
else if (input->checkInput(input_window_size_1, REPEAT_FALSE))
|
||||||
screen->setWindowSize(2);
|
{
|
||||||
resource->reLoadTextures();
|
screen->setWindowSize(1);
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F3:
|
else if (input->checkInput(input_window_size_2, REPEAT_FALSE))
|
||||||
screen->setWindowSize(3);
|
{
|
||||||
resource->reLoadTextures();
|
screen->setWindowSize(2);
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F4:
|
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
|
||||||
screen->setWindowSize(4);
|
{
|
||||||
resource->reLoadTextures();
|
screen->setWindowSize(3);
|
||||||
break;
|
}
|
||||||
|
|
||||||
case SDL_SCANCODE_F5:
|
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
|
||||||
switchPalette();
|
{
|
||||||
break;
|
screen->setWindowSize(4);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
else if (input->checkInput(input_swap_palette, REPEAT_FALSE))
|
||||||
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
{
|
||||||
endSection();
|
switchPalette();
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
else if (input->checkAnyInput())
|
||||||
|
{
|
||||||
|
section->subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||||
|
endSection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,6 +268,9 @@ void Logo::update()
|
|||||||
// Comprueba el manejador de eventos
|
// Comprueba el manejador de eventos
|
||||||
checkEventHandler();
|
checkEventHandler();
|
||||||
|
|
||||||
|
// Comprueba las entradas
|
||||||
|
void checkInput();
|
||||||
|
|
||||||
// Incrementa el contador
|
// Incrementa el contador
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -21,6 +22,7 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
Texture *texture; // Textura con los graficos "JAILGAMES"
|
Texture *texture; // Textura con los graficos "JAILGAMES"
|
||||||
Texture *texture2; // Textura con los graficos "Since 1998"
|
Texture *texture2; // Textura con los graficos "Since 1998"
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
@@ -47,6 +49,9 @@ private:
|
|||||||
// Comprueba el manejador de eventos
|
// Comprueba el manejador de eventos
|
||||||
void checkEventHandler();
|
void checkEventHandler();
|
||||||
|
|
||||||
|
// Comprueba las entradas
|
||||||
|
void checkInput();
|
||||||
|
|
||||||
// Gestiona el logo de JAILGAME
|
// Gestiona el logo de JAILGAME
|
||||||
void updateJAILGAMES();
|
void updateJAILGAMES();
|
||||||
|
|
||||||
@@ -61,7 +66,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
Logo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Logo();
|
~Logo();
|
||||||
|
|||||||
@@ -3,14 +3,15 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, options_t *options, board_t *board)
|
ScoreBoard::ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, Input *input, options_t *options, board_t *board)
|
||||||
{
|
{
|
||||||
// Obten punteros a objetos
|
// Obten punteros a objetos
|
||||||
|
this->renderer = renderer;
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->renderer = renderer;
|
this->input = input;
|
||||||
this->board = board;
|
|
||||||
this->options = options;
|
this->options = options;
|
||||||
|
this->board = board;
|
||||||
|
|
||||||
// Reserva memoria para los objetos
|
// Reserva memoria para los objetos
|
||||||
itemTexture = resource->getTexture("items.png");
|
itemTexture = resource->getTexture("items.png");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/animatedsprite.h"
|
#include "common/animatedsprite.h"
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/text.h"
|
#include "common/text.h"
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
@@ -39,6 +40,7 @@ private:
|
|||||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
Text *text; // Objeto para escribir texto
|
Text *text; // Objeto para escribir texto
|
||||||
Texture *itemTexture; // Textura con los graficos para las vidas
|
Texture *itemTexture; // Textura con los graficos para las vidas
|
||||||
board_t *board; // Contiene las variables a mostrar en el marcador
|
board_t *board; // Contiene las variables a mostrar en el marcador
|
||||||
@@ -62,7 +64,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, options_t *options, board_t *board);
|
ScoreBoard(SDL_Renderer *renderer, Resource *resource, Asset *asset, Input *input, options_t *options, board_t *board);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~ScoreBoard();
|
~ScoreBoard();
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
#include "title.h"
|
#include "title.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section)
|
Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->resource = resource;
|
this->resource = resource;
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
|
this->input = input;
|
||||||
this->options = options;
|
this->options = options;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "common/asset.h"
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
#include "common/jail_audio.h"
|
#include "common/jail_audio.h"
|
||||||
#include "common/resource.h"
|
#include "common/resource.h"
|
||||||
#include "common/screen.h"
|
#include "common/screen.h"
|
||||||
@@ -29,6 +30,7 @@ private:
|
|||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Resource *resource; // Objeto con los recursos
|
Resource *resource; // Objeto con los recursos
|
||||||
Asset *asset; // Objeto con los ficheros de recursos
|
Asset *asset; // Objeto con los ficheros de recursos
|
||||||
|
Input *input; // Objeto pata gestionar la entrada
|
||||||
SDL_Event *eventHandler; // Manejador de eventos
|
SDL_Event *eventHandler; // Manejador de eventos
|
||||||
Texture *texture; // Textura con los graficos
|
Texture *texture; // Textura con los graficos
|
||||||
Sprite *sprite; // Sprite para manejar la textura
|
Sprite *sprite; // Sprite para manejar la textura
|
||||||
@@ -69,7 +71,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options, section_t *section);
|
Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Title();
|
~Title();
|
||||||
|
|||||||
Reference in New Issue
Block a user