afegides notificacions per als inputs externs al joc

This commit is contained in:
2024-08-03 13:55:16 +02:00
parent 256959505d
commit 958a4d1d99
13 changed files with 78 additions and 33 deletions

View File

@@ -37,6 +37,9 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
shakeEffect.origin = 0;
attenuateEffect = false;
// Crea los objetos
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
// Define el color del borde para el modo de pantalla completa
borderColor = {0x00, 0x00, 0x00};
@@ -53,6 +56,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
// Destructor
Screen::~Screen()
{
delete notify;
SDL_DestroyTexture(gameCanvas);
}
@@ -232,7 +236,7 @@ void Screen::setVideoMode(int videoMode)
// Camibia entre pantalla completa y ventana
void Screen::switchVideoMode()
{
options->video.mode = (options->video.mode == VIDEO_MODE_WINDOW) ? VIDEO_MODE_FULLSCREEN : VIDEO_MODE_WINDOW;
options->video.mode = options->video.mode == VIDEO_MODE_WINDOW ? VIDEO_MODE_FULLSCREEN : VIDEO_MODE_WINDOW;
setVideoMode(options->video.mode);
}
@@ -309,21 +313,29 @@ void Screen::checkInput()
if (input->checkInput(input_window_fullscreen, DO_NOT_ALLOW_REPEAT))
{
switchVideoMode();
const std::string mode = options->video.mode == VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
showNotification(mode + " mode");
}
else if (input->checkInput(input_window_dec_size, 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))
{
incWindowSize();
const std::string size = std::to_string(options->video.window.size);
showNotification("Window size x" + size);
}
else if (input->checkInput(input_video_shaders, DO_NOT_ALLOW_REPEAT))
{
switchShaders();
const std::string value = options->video.shaders ? "on" : "off";
showNotification("Shaders " + value);
}
}