Reasignados los controles para ordenador, mando y consola

This commit is contained in:
2023-02-12 18:50:40 +01:00
parent ca99857b5b
commit cbb5d54250
8 changed files with 154 additions and 140 deletions

View File

@@ -4,12 +4,13 @@
#define END_LOGO 200
// Constructor
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset)
Logo::Logo(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input)
{
// Copia la dirección de los objetos
this->renderer = renderer;
this->screen = screen;
this->asset = asset;
this->input = input;
// Reserva memoria para los punteros
eventHandler = new SDL_Event();
@@ -56,47 +57,36 @@ void Logo::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 Logo::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("Conectado a Jailers.net");
break;
default:
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))
{
section.name = PROG_SECTION_TITLE;
section.subsection = TITLE_SECTION_1;
}
}
@@ -117,6 +107,7 @@ void Logo::renderFade()
void Logo::update()
{
checkEventHandler();
checkInput();
if (SDL_GetTicks() - ticks > ticksSpeed)
{