forked from jaildesigner-jailgames/jaildoctors_dilemma
Preparando el juego para ser compatble con consolas
This commit is contained in:
@@ -129,6 +129,10 @@ void Director::initOptions()
|
||||
options->borderHeight = 24;
|
||||
options->palette = p_zxspectrum;
|
||||
|
||||
#ifdef GAME_CONSOLE
|
||||
options->windowSize = 2;
|
||||
#endif
|
||||
|
||||
// Estos valores no se guardan en el fichero de configuraci´ón
|
||||
options->console = false;
|
||||
options->cheat.infiniteLives = false;
|
||||
@@ -1230,14 +1234,14 @@ void Director::initInput()
|
||||
input->bindKey(INPUT_BUTTON_PAUSE, SDL_SCANCODE_ESCAPE);
|
||||
input->bindKey(INPUT_BUTTON_ESCAPE, SDL_SCANCODE_ESCAPE);
|
||||
|
||||
input->bindGameControllerButton(INPUT_UP, SDL_CONTROLLER_BUTTON_DPAD_UP);
|
||||
input->bindGameControllerButton(INPUT_UP, SDL_CONTROLLER_BUTTON_B);
|
||||
input->bindGameControllerButton(INPUT_DOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
|
||||
input->bindGameControllerButton(INPUT_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT);
|
||||
input->bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
input->bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_B);
|
||||
input->bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_A);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_B);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_GUIDE);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_START);
|
||||
input->bindGameControllerButton(INPUT_BUTTON_ESCAPE, SDL_CONTROLLER_BUTTON_GUIDE);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
l.enabled = false;
|
||||
letters.push_back(l);
|
||||
}
|
||||
letters.at(0).enabled = true;
|
||||
letters[0].enabled = true;
|
||||
marqueeSpeed = 3;
|
||||
|
||||
// Cambia el color del borde
|
||||
@@ -70,6 +70,12 @@ void Title::checkEventHandler()
|
||||
// Comprueba las teclas que se han pulsado
|
||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
if (eventHandler->type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
section.name = SECTION_PROG_GAME;
|
||||
section.subsection = 0;
|
||||
}
|
||||
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
@@ -133,20 +139,20 @@ void Title::updateMarquee()
|
||||
{
|
||||
for (int i = 0; i < (int)letters.size(); ++i)
|
||||
{
|
||||
if (letters.at(i).enabled)
|
||||
if (letters[i].enabled)
|
||||
{
|
||||
letters.at(i).x -= marqueeSpeed;
|
||||
if (letters.at(i).x < -10)
|
||||
letters[i].x -= marqueeSpeed;
|
||||
if (letters[i].x < -10)
|
||||
{
|
||||
letters.at(i).enabled = false;
|
||||
letters[i].enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i > 0 && letters.at(i - 1).x < 256 && letters.at(i - 1).enabled)
|
||||
if (i > 0 && letters[i - 1].x < 256 && letters[i - 1].enabled)
|
||||
{
|
||||
letters.at(i).enabled = true;
|
||||
letters.at(i).x = letters.at(i - 1).x + text->lenght(letters.at(i - 1).letter) + 1;
|
||||
letters[i].enabled = true;
|
||||
letters[i].x = letters[i - 1].x + text->lenght(letters[i - 1].letter) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +192,7 @@ void Title::update()
|
||||
screen->updateNotifier();
|
||||
|
||||
// Comprueba si ha terminado la marquesina y acaba con el titulo
|
||||
if (letters.at(letters.size() - 1).x < -10)
|
||||
if (letters[letters.size() - 1].x < -10)
|
||||
{
|
||||
section.name = SECTION_PROG_CREDITS;
|
||||
section.subsection = 0;
|
||||
@@ -206,15 +212,6 @@ void Title::render()
|
||||
// Dibuja el fondo del titulo
|
||||
sprite->render();
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
// SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
|
||||
// const SDL_Rect rect = {0, 192 / 5 * 4, 256, 8};
|
||||
// SDL_RenderFillRect(renderer, &rect);
|
||||
// if (counter % 80 < 60)
|
||||
//{
|
||||
// text->writeCentered(256 / 2, 192 / 5 * 4, "PRESS ENTER TO PLAY");
|
||||
//}
|
||||
|
||||
// Dibuja el texto de PRESS ENTER TO PLAY
|
||||
if (counter % 80 < 60)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@ private:
|
||||
Sprite *sprite; // Sprite para manejar la textura
|
||||
Text *text; // Objeto para escribir texto en pantalla
|
||||
options_t *options; // Puntero a las opciones del juego
|
||||
//Texture *pressEnterTexture; // Textura con los graficos de PRESS ENTER
|
||||
//Sprite *pressEnterSprite; // Sprite para manejar la textura de PRESS ENTER
|
||||
|
||||
// Variables
|
||||
int counter; // Contador
|
||||
|
||||
Reference in New Issue
Block a user