Files
coffee_crisis_arcade_edition/source/global_events.cpp

34 lines
974 B
C++

#include "global_events.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory
#include "mouse.h" // Para handleEvent
#include "section.h" // Para Name, Options, name, options
#include "screen.h"
namespace GlobalEvents
{
// Comprueba los eventos que se pueden producir en cualquier sección del juego
void check(const SDL_Event &event)
{
switch (event.type)
{
case SDL_EVENT_QUIT: // Evento de salida de la aplicación
Section::name = Section::Name::QUIT;
Section::options = Section::Options::NONE;
return;
case SDL_EVENT_RENDER_DEVICE_RESET:
case SDL_EVENT_RENDER_TARGETS_RESET:
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "SDL_RENDER_TARGETS_RESET");
break;
case SDL_EVENT_WINDOW_RESIZED:
Screen::get()->initShaders();
break;
default:
break;
}
Mouse::handleEvent(event);
}
}