forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya rueda por los diferentes estados del juego: logo, titulo, creditos, demo
This commit is contained in:
3
Makefile
3
Makefile
@@ -3,7 +3,8 @@ executable = jaildoctors_dilemma
|
|||||||
windows:
|
windows:
|
||||||
@echo off
|
@echo off
|
||||||
if not exist bin\ (mkdir bin)
|
if not exist bin\ (mkdir bin)
|
||||||
g++ source/*.cpp source/utils/*.cpp -std=c++11 -Wall -O2 -lmingw32 -lSDL2main -lSDL2 -o bin/$(executable).exe
|
g++ source/*.cpp source/utils/*.cpp -std=c++11 -Wall -O2 -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -o bin/$(executable).exe
|
||||||
|
strip -s -R .comment -R .gnu.version bin/$(executable).exe --strip-unneeded
|
||||||
macos:
|
macos:
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
g++ source/*.cpp source/utils/*.cpp -std=c++11 -Wall -O2 -lSDL2 -o bin/$(executable)_macos
|
g++ source/*.cpp source/utils/*.cpp -std=c++11 -Wall -O2 -lSDL2 -o bin/$(executable)_macos
|
||||||
|
|||||||
@@ -57,13 +57,8 @@ const int GAMECANVAS_THIRD_QUARTER_Y = (GAMECANVAS_HEIGHT / 4) * 3;
|
|||||||
#define SECTION_PROG_QUIT 6
|
#define SECTION_PROG_QUIT 6
|
||||||
|
|
||||||
// Subsecciones
|
// Subsecciones
|
||||||
#define SUBSECTION_GAME_PLAY 0
|
#define SUBSECTION_LOGO_TO_INTRO 0
|
||||||
#define SUBSECTION_GAME_PAUSE 1
|
#define SUBSECTION_LOGO_TO_TITLE 1
|
||||||
#define SUBSECTION_GAME_GAMEOVER 2
|
|
||||||
#define SUBSECTION_TITLE_1 3
|
|
||||||
#define SUBSECTION_TITLE_2 4
|
|
||||||
#define SUBSECTION_TITLE_3 5
|
|
||||||
#define SUBSECTION_TITLE_INSTRUCTIONS 6
|
|
||||||
|
|
||||||
// Colores
|
// Colores
|
||||||
const color_t borderColor = {0x27, 0x27, 0x36};
|
const color_t borderColor = {0x27, 0x27, 0x36};
|
||||||
|
|||||||
@@ -139,22 +139,7 @@ void Demo::update()
|
|||||||
room->update();
|
room->update();
|
||||||
scoreboard->update();
|
scoreboard->update();
|
||||||
screen->updateFX();
|
screen->updateFX();
|
||||||
{
|
checkRoomChange();
|
||||||
counter++;
|
|
||||||
if (counter == 400)
|
|
||||||
{
|
|
||||||
counter = 0;
|
|
||||||
roomIndex++;
|
|
||||||
if (roomIndex == (int)rooms.size())
|
|
||||||
{
|
|
||||||
section.name = SECTION_PROG_TITLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
changeRoom(rooms.at(roomIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,3 +207,23 @@ bool Demo::changeRoom(std::string file)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Comprueba si se ha de cambiar de habitación
|
||||||
|
void Demo::checkRoomChange()
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
if (counter == 400)
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
roomIndex++;
|
||||||
|
if (roomIndex == (int)rooms.size())
|
||||||
|
{
|
||||||
|
section.name = SECTION_PROG_LOGO;
|
||||||
|
section.subsection = SUBSECTION_LOGO_TO_TITLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
changeRoom(rooms.at(roomIndex));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,6 +61,9 @@ private:
|
|||||||
// Cambia de habitación
|
// Cambia de habitación
|
||||||
bool changeRoom(std::string file);
|
bool changeRoom(std::string file);
|
||||||
|
|
||||||
|
// Comprueba si se ha de cambiar de habitación
|
||||||
|
void checkRoomChange();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Demo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Debug *debug);
|
Demo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Debug *debug);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
Director::Director(std::string path)
|
Director::Director(std::string path)
|
||||||
{
|
{
|
||||||
section.name = SECTION_PROG_LOGO;
|
section.name = SECTION_PROG_LOGO;
|
||||||
section.subsection = 0;
|
section.subsection = SUBSECTION_LOGO_TO_INTRO;
|
||||||
|
|
||||||
section.name = SECTION_PROG_CREDITS;
|
section.name = SECTION_PROG_CREDITS;
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ void Director::setSection(section_t section)
|
|||||||
// 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);
|
logo = new Logo(renderer, screen, asset, section.subsection);
|
||||||
setSection(logo->run());
|
setSection(logo->run());
|
||||||
delete logo;
|
delete logo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, D
|
|||||||
board.music = !debug->getEnabled();
|
board.music = !debug->getEnabled();
|
||||||
|
|
||||||
section.name = SECTION_PROG_GAME;
|
section.name = SECTION_PROG_GAME;
|
||||||
section.subsection = SUBSECTION_GAME_PLAY;
|
section.subsection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
@@ -174,14 +174,10 @@ section_t Game::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (section.name == SECTION_PROG_GAME)
|
while (section.name == SECTION_PROG_GAME)
|
||||||
{
|
|
||||||
// Sección juego jugando
|
|
||||||
if (section.subsection == SUBSECTION_GAME_PLAY)
|
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "logo.h"
|
#include "logo.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset)
|
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, int subsection)
|
||||||
{
|
{
|
||||||
// Copia la dirección de los objetos
|
// Copia la dirección de los objetos
|
||||||
this->renderer = renderer;
|
this->renderer = renderer;
|
||||||
@@ -33,7 +33,7 @@ Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset)
|
|||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
counter = 0;
|
counter = 0;
|
||||||
section.name = SECTION_PROG_LOGO;
|
section.name = SECTION_PROG_LOGO;
|
||||||
section.subsection = 0;
|
section.subsection = subsection;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
ticksSpeed = 15;
|
ticksSpeed = 15;
|
||||||
initFade = 300;
|
initFade = 300;
|
||||||
@@ -237,10 +237,18 @@ void Logo::update()
|
|||||||
|
|
||||||
// Comprueba si ha terminado el logo
|
// Comprueba si ha terminado el logo
|
||||||
if (counter == endLogo + postLogo)
|
if (counter == endLogo + postLogo)
|
||||||
|
{
|
||||||
|
if (section.subsection == SUBSECTION_LOGO_TO_INTRO)
|
||||||
{
|
{
|
||||||
section.name = SECTION_PROG_INTRO;
|
section.name = SECTION_PROG_INTRO;
|
||||||
section.subsection = 0;
|
section.subsection = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
section.name = SECTION_PROG_TITLE;
|
||||||
|
section.subsection = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset);
|
Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, int subsection);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Logo();
|
~Logo();
|
||||||
|
|||||||
Reference in New Issue
Block a user