afegides les normes de les guidelines jailerianes
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
#include "global_inputs.h"
|
||||
#include <SDL3/SDL.h> // Para SDL_RendererLogicalPresentation, SDL_Se...
|
||||
#include <string> // Para operator+, allocator, char_traits, string
|
||||
#include <vector> // Para vector
|
||||
#include "audio.h" // Para JA_SetMusicVolume, JA_SetSoundVolume
|
||||
#include "options.h" // Para Options, options, VideoOptions, GameOpt...
|
||||
#include "screen.h" // Para Screen
|
||||
#include "utils.h" // Para boolToOnOff
|
||||
|
||||
namespace globalInputs
|
||||
{
|
||||
|
||||
// Activa o desactiva el audio
|
||||
void toggleAudio()
|
||||
{
|
||||
options.audio.enabled = !options.audio.enabled;
|
||||
Audio::get()->enable(options.audio.enabled);
|
||||
}
|
||||
|
||||
// Cambia el modo de escalado entero
|
||||
void toggleIntegerScale()
|
||||
{
|
||||
Screen::get()->toggleIntegerScale();
|
||||
}
|
||||
|
||||
// Activa / desactiva el vsync
|
||||
void toggleVSync()
|
||||
{
|
||||
Screen::get()->toggleVSync();
|
||||
}
|
||||
|
||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||
void check(const SDL_Event &event)
|
||||
{
|
||||
if (event.type == SDL_EVENT_KEY_DOWN && event.key.repeat == 0)
|
||||
{
|
||||
switch (event.key.key)
|
||||
{
|
||||
// Salir
|
||||
case SDLK_ESCAPE:
|
||||
options.logo.running = false;
|
||||
return;
|
||||
|
||||
// Decrementar el tamaño de la ventana
|
||||
case SDLK_F1:
|
||||
Screen::get()->decWindowZoom();
|
||||
return;
|
||||
|
||||
// Incrementar el tamaño de la ventana
|
||||
case SDLK_F2:
|
||||
Screen::get()->incWindowZoom();
|
||||
return;
|
||||
|
||||
// Cambiar entre pantalla completa y ventana
|
||||
case SDLK_F3:
|
||||
Screen::get()->toggleFullscreen();
|
||||
return;
|
||||
|
||||
// Integer Scale
|
||||
case SDLK_F5:
|
||||
toggleIntegerScale();
|
||||
return;
|
||||
|
||||
// VSync
|
||||
case SDLK_F6:
|
||||
toggleVSync();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user