afegida tecla per activar o desactivar el vsync

This commit is contained in:
2025-03-28 08:38:28 +01:00
parent 11d015daf8
commit 25cd6b00eb
13 changed files with 109 additions and 67 deletions

View File

@@ -4,7 +4,7 @@
#include <SDL3/SDL_error.h> // Para SDL_GetError
#include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
#include <SDL3/SDL_init.h> // Para SDL_Init, SDL_Quit, SDL_INIT_AUDIO
#include <SDL3/SDL.h> // Para SDL_Log, SDL_LogCategory, SDL_LogE...
#include <SDL3/SDL.h> // Para SDL_Log, SDL_LogCategory, SDL_LogE...
#include <SDL3/SDL_scancode.h> // Para SDL_Scancode
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOOLONG
#include <stdio.h> // Para printf, perror
@@ -49,12 +49,12 @@ Director::Director(int argc, const char *argv[])
section::name = section::Name::GAME;
section::options = section::Options::GAME_PLAY_1P;
#elif DEBUG
section::name = section::Name::LOGO;
section::name = section::Name::INTRO;
#else // NORMAL GAME
section::name = section::Name::LOGO;
#endif
section::options = section::Options::NONE;
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
#endif
// Establece el nivel de prioridad de la categoría de registro
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
@@ -171,12 +171,13 @@ void Director::bindInputs()
Input::get()->bindKey(InputAction::WINDOW_DEC_SIZE, SDL_SCANCODE_F1);
Input::get()->bindKey(InputAction::WINDOW_INC_SIZE, SDL_SCANCODE_F2);
Input::get()->bindKey(InputAction::WINDOW_FULLSCREEN, SDL_SCANCODE_F3);
Input::get()->bindKey(InputAction::VIDEO_SHADERS, SDL_SCANCODE_F4);
Input::get()->bindKey(InputAction::VIDEO_INTEGER_SCALE, SDL_SCANCODE_F5);
Input::get()->bindKey(InputAction::TOGGLE_VIDEO_SHADERS, SDL_SCANCODE_F4);
Input::get()->bindKey(InputAction::TOGGLE_VIDEO_INTEGER_SCALE, SDL_SCANCODE_F5);
Input::get()->bindKey(InputAction::TOGGLE_VIDEO_VSYNC, SDL_SCANCODE_F6);
Input::get()->bindKey(InputAction::MUTE, SDL_SCANCODE_F6);
Input::get()->bindKey(InputAction::AUTO_FIRE, SDL_SCANCODE_F7);
Input::get()->bindKey(InputAction::CHANGE_LANG, SDL_SCANCODE_F8);
Input::get()->bindKey(InputAction::TOGGLE_AUDIO, SDL_SCANCODE_F7);
Input::get()->bindKey(InputAction::TOGGLE_AUTO_FIRE, SDL_SCANCODE_F8);
Input::get()->bindKey(InputAction::CHANGE_LANG, SDL_SCANCODE_F9);
Input::get()->bindKey(InputAction::RESET, SDL_SCANCODE_F10);
@@ -224,8 +225,8 @@ void Director::bindInputs()
Input::get()->bindGameControllerButton(i, InputAction::EXIT, InputAction::START);
Input::get()->bindGameControllerButton(i, InputAction::RESET, InputAction::FIRE_CENTER);
Input::get()->bindGameControllerButton(i, InputAction::PAUSE, InputAction::FIRE_RIGHT);
Input::get()->bindGameControllerButton(i, InputAction::VIDEO_SHADERS, InputAction::FIRE_LEFT);
Input::get()->bindGameControllerButton(i, InputAction::MUTE, InputAction::LEFT);
Input::get()->bindGameControllerButton(i, InputAction::TOGGLE_VIDEO_SHADERS, InputAction::FIRE_LEFT);
Input::get()->bindGameControllerButton(i, InputAction::TOGGLE_AUDIO, InputAction::LEFT);
Input::get()->bindGameControllerButton(i, InputAction::SHOW_INFO, InputAction::RIGHT);
Input::get()->bindGameControllerButton(i, InputAction::CONFIG, InputAction::DOWN);
Input::get()->bindGameControllerButton(i, InputAction::SWAP_CONTROLLERS, InputAction::UP);
@@ -262,7 +263,7 @@ void Director::initJailAudio()
}
else
{
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** SDL_AUDIO: INITIALIZING\n");
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "\n** SDL_AUDIO: INITIALIZING\n");
JA_Init(48000, SDL_AUDIO_S16LE, 2);
if (options.audio.enabled)
@@ -276,7 +277,7 @@ void Director::initJailAudio()
JA_SetSoundVolume(0);
}
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "** SDL_AUDIO: INITIALIZATION COMPLETE\n");
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "** SDL_AUDIO: INITIALIZATION COMPLETE\n");
}
}