Ya funcionan los nuevos inputs de teclado y mando durante la tabla de records
This commit is contained in:
@@ -5,12 +5,13 @@
|
||||
const Uint8 SELF = 0;
|
||||
|
||||
// Constructor
|
||||
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, options_t *options)
|
||||
HiScoreTable::HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options)
|
||||
{
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->lang = lang;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
@@ -52,6 +53,9 @@ void HiScoreTable::update()
|
||||
// Comprueba los eventos
|
||||
checkEventHandler();
|
||||
|
||||
// Comprueba las entradas
|
||||
checkInput();
|
||||
|
||||
// Actualiza las variables
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
@@ -178,8 +182,33 @@ void HiScoreTable::checkEventHandler()
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((eventHandler->type == SDL_KEYUP) || (eventHandler->type == SDL_JOYBUTTONUP))
|
||||
// Comprueba las entradas
|
||||
void HiScoreTable::checkInput()
|
||||
{
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE))
|
||||
{
|
||||
section.name = PROG_SECTION_QUIT;
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
|
||||
{
|
||||
screen->switchVideoMode();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->decWindowSize();
|
||||
}
|
||||
|
||||
else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
|
||||
{
|
||||
screen->incWindowSize();
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
if (mode == mhst_auto)
|
||||
{
|
||||
@@ -195,7 +224,6 @@ void HiScoreTable::checkEventHandler()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bucle para la pantalla de instrucciones
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "common/asset.h"
|
||||
#include "common/input.h"
|
||||
#include "common/jail_audio.h"
|
||||
#include "common/screen.h"
|
||||
#include "common/sprite.h"
|
||||
@@ -27,6 +28,7 @@ private:
|
||||
SDL_Event *eventHandler; // Manejador de eventos
|
||||
SDL_Texture *backbuffer; // Textura para usar como backbuffer
|
||||
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||
Input *input; // Objeto pata gestionar la entrada
|
||||
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Text *text; // Objeto para escribir texto
|
||||
options_t *options; // Opciones y parametyros del programa
|
||||
@@ -49,12 +51,15 @@ private:
|
||||
// Comprueba los eventos
|
||||
void checkEventHandler();
|
||||
|
||||
// Comprueba las entradas
|
||||
void checkInput();
|
||||
|
||||
// Transforma un valor numérico en una cadena de 6 cifras
|
||||
std::string scoreToString(Uint32 num);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *mAsset, Lang *lang, options_t *options);
|
||||
HiScoreTable(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, options_t *options);
|
||||
|
||||
// Destructor
|
||||
~HiScoreTable();
|
||||
|
||||
@@ -975,7 +975,7 @@ section_t Title::runHiScoreTable(mode_hiScoreTable_e mode)
|
||||
return section;
|
||||
}
|
||||
|
||||
hiScoreTable = new HiScoreTable(renderer, screen, asset, lang, options);
|
||||
hiScoreTable = new HiScoreTable(renderer, screen, asset, input, lang, options);
|
||||
section = hiScoreTable->run(mode);
|
||||
delete hiScoreTable;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user