Moguts els checkInputs de Screen a GlobalInputs

This commit is contained in:
2024-11-01 19:07:19 +01:00
parent c66cc965f1
commit 2dd8bbbbf7
9 changed files with 147 additions and 159 deletions

View File

@@ -98,7 +98,7 @@ void Screen::blit()
OnScreenHelp::get()->render();
// Muestra información por pantalla
displayInfo();
renderInfo();
// Muestra las notificaciones
Notifier::get()->render();
@@ -210,7 +210,7 @@ void Screen::setVideoMode(ScreenVideoMode videoMode)
}
// Camibia entre pantalla completa y ventana
void Screen::switchVideoMode()
void Screen::toggleVideoMode()
{
options.video.mode = options.video.mode == ScreenVideoMode::WINDOW ? ScreenVideoMode::FULLSCREEN : ScreenVideoMode::WINDOW;
setVideoMode(options.video.mode);
@@ -260,74 +260,6 @@ void Screen::update()
OnScreenHelp::get()->update();
}
// Comprueba las entradas
void Screen::checkInput()
{
#ifndef ARCADE
// Comprueba el teclado para cambiar entre pantalla completa y ventana
if (Input::get()->checkInput(InputType::WINDOW_FULLSCREEN, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
switchVideoMode();
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
Notifier::get()->showText(mode + " mode");
return;
}
// Comprueba el teclado para decrementar el tamaño de la ventana
if (Input::get()->checkInput(InputType::WINDOW_DEC_SIZE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
decWindowSize();
const std::string size = std::to_string(options.video.window.size);
Notifier::get()->showText("Window size x" + size);
return;
}
// Comprueba el teclado para incrementar el tamaño de la ventana
if (Input::get()->checkInput(InputType::WINDOW_INC_SIZE, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
incWindowSize();
const std::string size = std::to_string(options.video.window.size);
Notifier::get()->showText("Window size x" + size);
return;
}
#endif
// Comprueba el teclado para activar o desactivar los shaders
if (Input::get()->checkInput(InputType::VIDEO_SHADERS, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
switchShaders();
return;
}
#ifdef DEBUG
// Comprueba el teclado para mostrar la información de debug
if (Input::get()->checkInput(InputType::SHOWINFO, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_KEYBOARD))
{
show_info_ = !show_info_;
return;
}
#endif
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
{
// Comprueba los mandos para activar o desactivar los shaders
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i) &&
Input::get()->checkInput(InputType::VIDEO_SHADERS, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
switchShaders();
return;
}
// Comprueba los mandos para mostrar la información de debug
if (Input::get()->checkInput(InputType::SERVICE, INPUT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i) &&
Input::get()->checkInput(InputType::SHOWINFO, INPUT_DO_NOT_ALLOW_REPEAT, INPUT_USE_GAMECONTROLLER, i))
{
show_info_ = !show_info_;
return;
}
}
}
// Agita la pantalla
void Screen::shake()
{
@@ -404,8 +336,8 @@ void Screen::doAttenuate()
}
}
// Activa/desactiva los shaders
void Screen::switchShaders()
// Activa / desactiva los shaders
void Screen::toggleShaders()
{
options.video.shaders = !options.video.shaders;
setVideoMode(options.video.mode);
@@ -413,6 +345,12 @@ void Screen::switchShaders()
Notifier::get()->showText("Shaders " + value);
}
// Activa / desactiva la información de debug
void Screen::toggleDebugInfo()
{
show_info_ = !show_info_;
}
// Atenua la pantalla
void Screen::attenuate(bool value)
{
@@ -437,7 +375,7 @@ void Screen::updateFPS()
}
// Muestra información por pantalla
void Screen::displayInfo()
void Screen::renderInfo()
{
if (show_info_)
{