Ya funcionan los nuevos inputs de teclado y mando en el logo
Ya funcionan los nuevos inputs de teclado y mando en la intro
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
#include "intro.h"
|
||||
|
||||
// Constructor
|
||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang)
|
||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->lang = lang;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
|
||||
// Reserva memoria para los objetos
|
||||
eventHandler = new SDL_Event();
|
||||
@@ -183,48 +184,37 @@ void Intro::checkEventHandler()
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cualquier tecla pulsada
|
||||
if ((eventHandler->type == SDL_KEYDOWN) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
texture->reLoad();
|
||||
break;
|
||||
// Comprueba las entradas
|
||||
void Intro::checkInput()
|
||||
{
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F1:
|
||||
screen->setWindowSize(1);
|
||||
texture->reLoad();
|
||||
break;
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F2:
|
||||
screen->setWindowSize(2);
|
||||
texture->reLoad();
|
||||
break;
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F3:
|
||||
screen->setWindowSize(3);
|
||||
texture->reLoad();
|
||||
break;
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
case SDL_SCANCODE_F4:
|
||||
screen->setWindowSize(4);
|
||||
texture->reLoad();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F5:
|
||||
screen->showNotification("HOLA MAMA!");
|
||||
break;
|
||||
|
||||
default:
|
||||
JA_StopMusic();
|
||||
section.name = PROG_SECTION_TITLE;
|
||||
section.subsection = TITLE_SECTION_1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_fire_left, REPEAT_FALSE) || input->checkInput(input_fire_center, REPEAT_FALSE) || input->checkInput(input_fire_right, REPEAT_FALSE))
|
||||
{
|
||||
JA_StopMusic();
|
||||
section.name = PROG_SECTION_TITLE;
|
||||
section.subsection = TITLE_SECTION_1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,6 +378,7 @@ void Intro::updateScenes()
|
||||
void Intro::update()
|
||||
{
|
||||
checkEventHandler();
|
||||
checkInput();
|
||||
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user