diff --git a/source/director.cpp b/source/director.cpp index 8b1c829..0c62e77 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -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); } diff --git a/source/title.cpp b/source/title.cpp index 15b6d85..2d90679 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -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) { diff --git a/source/title.h b/source/title.h index ac11a95..615faa4 100644 --- a/source/title.h +++ b/source/title.h @@ -25,15 +25,17 @@ private: }; // Objetos y punteros - SDL_Renderer *renderer; // El renderizador de la ventana - Screen *screen; // Objeto encargado de dibujar en pantalla - Resource *resource; // Objeto con los recursos - Asset *asset; // Objeto con los ficheros de recursos - SDL_Event *eventHandler; // Manejador de eventos - Texture *texture; // Textura con los graficos - Sprite *sprite; // Sprite para manejar la textura - Text *text; // Objeto para escribir texto en pantalla - options_t *options; // Puntero a las opciones del juego + SDL_Renderer *renderer; // El renderizador de la ventana + Screen *screen; // Objeto encargado de dibujar en pantalla + Resource *resource; // Objeto con los recursos + Asset *asset; // Objeto con los ficheros de recursos + SDL_Event *eventHandler; // Manejador de eventos + Texture *texture; // Textura con los graficos + 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