Añadidas nuevas funciones al botón de servicio

El botón de servicio se puede usar en cualquier sección del juego
This commit is contained in:
2024-09-15 13:03:53 +02:00
parent a435e3ed8c
commit 04935c652d
14 changed files with 171 additions and 40 deletions

View File

@@ -225,7 +225,13 @@ bool Input::checkAnyInput(int device, int index)
// Comprueba si hay algún botón pulsado. Devuelve 0 en caso de no encontrar nada o el indice del dispositivo + 1. Se hace así para poder gastar el valor devuelto como un valor "booleano"
int Input::checkAnyButtonPressed(bool repeat)
{
// Solo comprueba los botones
// Si está pulsado el botón de servicio, ningún botón se puede considerar pulsado
if (checkInput(input_service, INPUT_ALLOW_REPEAT, INPUT_USE_ANY))
{
return 0;
}
// Solo comprueba los botones definidos previamente
for (auto bi : buttonInputs)
{
// Comprueba el teclado

View File

@@ -44,8 +44,8 @@ enum inputs_e
input_number_of_inputs
};
#define ALLOW_REPEAT true
#define DO_NOT_ALLOW_REPEAT false
#define INPUT_ALLOW_REPEAT true
#define INPUT_DO_NOT_ALLOW_REPEAT false
#define INPUT_USE_KEYBOARD 0
#define INPUT_USE_GAMECONTROLLER 1
@@ -111,7 +111,7 @@ public:
bool checkAnyInput(int device = INPUT_USE_ANY, int index = 0);
// Comprueba si hay algún botón pulsado
int checkAnyButtonPressed(bool repeat = DO_NOT_ALLOW_REPEAT);
int checkAnyButtonPressed(bool repeat = INPUT_DO_NOT_ALLOW_REPEAT);
// Busca si hay mandos conectados
bool discoverGameControllers();

View File

@@ -319,21 +319,21 @@ void Screen::update()
void Screen::checkInput()
{
#ifndef ARCADE
if (input->checkInput(input_window_fullscreen, DO_NOT_ALLOW_REPEAT))
if (input->checkInput(input_window_fullscreen, INPUT_DO_NOT_ALLOW_REPEAT))
{
switchVideoMode();
const std::string mode = options->video.mode == SCREEN_VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
showNotification(mode + " mode");
}
else if (input->checkInput(input_window_dec_size, DO_NOT_ALLOW_REPEAT))
else if (input->checkInput(input_window_dec_size, INPUT_DO_NOT_ALLOW_REPEAT))
{
decWindowSize();
const std::string size = std::to_string(options->video.window.size);
showNotification("Window size x" + size);
}
else if (input->checkInput(input_window_inc_size, DO_NOT_ALLOW_REPEAT))
else if (input->checkInput(input_window_inc_size, INPUT_DO_NOT_ALLOW_REPEAT))
{
incWindowSize();
const std::string size = std::to_string(options->video.window.size);
@@ -341,12 +341,12 @@ void Screen::checkInput()
}
#endif
if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
if (input->checkInput(input_video_shaders, INPUT_DO_NOT_ALLOW_REPEAT))
{
switchShaders();
}
else if (input->checkInput(input_showinfo, DO_NOT_ALLOW_REPEAT))
else if (input->checkInput(input_showinfo, INPUT_DO_NOT_ALLOW_REPEAT))
{
showInfo = !showInfo;
}