Files
coffee_crisis_arcade_edition/source/global_events.cpp

39 lines
1.1 KiB
C++

#include "global_events.h"
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory
#include "input.h"
#include "mouse.h" // Para handleEvent
#include "screen.h"
#include "section.hpp" // Para Name, Options, name, options
#include "ui/service_menu.h" // Para ServiceMenu
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;
}
ServiceMenu::get()->handleEvent(event);
Mouse::handleEvent(event);
static auto *input_ = Input::get();
input_->handleEvent(event);
}
} // namespace GlobalEvents