Asignada tecla F4 para activar/desactivar los shaders

This commit is contained in:
2024-06-30 09:48:49 +02:00
parent 12711d38f0
commit 097320cff7
5 changed files with 21 additions and 2 deletions

View File

@@ -24,9 +24,12 @@ enum inputs_e
input_fire_left,
input_fire_center,
input_fire_right,
// Inputs estandar
input_window_fullscreen,
input_window_inc_size,
input_window_dec_size,
input_video_shaders,
// Input obligatorio
input_number_of_inputs

View File

@@ -401,3 +401,10 @@ void Screen::doFlash()
flashEffect.counter < flashEffect.lenght ? flashEffect.counter++ : flashEffect.enabled = false;
}
}
// Activa/desactiva los shaders
void Screen::switchShaders()
{
options->video.shaders = !options->video.shaders;
setVideoMode(options->video.mode);
}

View File

@@ -136,6 +136,9 @@ public:
// Pone la pantalla de color
void flash(color_t color, int lenght);
// Activa/desactiva los shaders
void switchShaders();
};
#endif

View File

@@ -108,6 +108,7 @@ void Director::initInput()
input->bindKey(input_window_dec_size, SDL_SCANCODE_F1);
input->bindKey(input_window_inc_size, SDL_SCANCODE_F2);
input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3);
input->bindKey(input_video_shaders, SDL_SCANCODE_F4);
// Mando - Movimiento del jugador
input->bindGameControllerButton(input_up, SDL_CONTROLLER_BUTTON_DPAD_UP);
@@ -169,7 +170,7 @@ bool Director::initSDL()
}
}
if (options->video.shaders)
if (options->video.shaders || true)
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
{
if (options->console)
@@ -205,7 +206,7 @@ bool Director::initSDL()
}
// La aceleración se activa según las opciones
if (options->video.shaders)
if (options->video.shaders || true)
{
flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
}

View File

@@ -264,6 +264,11 @@ void Title::checkInput()
screen->incWindowSize();
}
else if (input->checkInput(input_video_shaders, REPEAT_FALSE))
{
screen->switchShaders();
}
else if (input->checkInput(input_accept, REPEAT_FALSE))
{
fade->activate();