33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
#include "global_events.h"
|
|
#include <SDL2/SDL_video.h> // Para SDL_WINDOWEVENT_SIZE_CHANGED
|
|
#include <iostream> // Para char_traits, basic_ostream, operator<<
|
|
#include "mouse.h" // Para handleEvent
|
|
#include "section.h" // Para Name, Options, name, options
|
|
|
|
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_QUIT: // Evento de salida de la aplicación
|
|
section::name = section::Name::QUIT;
|
|
section::options = section::Options::QUIT_FROM_EVENT;
|
|
return;
|
|
case SDL_RENDER_DEVICE_RESET:
|
|
case SDL_RENDER_TARGETS_RESET:
|
|
std::cout << "SDL_RENDER_TARGETS_RESET" << std::endl;
|
|
break;
|
|
case SDL_WINDOWEVENT:
|
|
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
|
{
|
|
std::cout << "SDL_WINDOWEVENT_SIZE_CHANGED" << std::endl;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
Mouse::handleEvent(event);
|
|
}
|
|
} |