Afegit global_events.cpp

This commit is contained in:
2025-03-10 23:24:00 +01:00
parent 9d98d3ea6a
commit 482dc3de54
26 changed files with 197 additions and 530 deletions

View File

@@ -62,32 +62,11 @@ void DefineButtons::bindButtons()
}
// Comprueba los eventos
void DefineButtons::checkEvents()
void DefineButtons::checkEvents(const SDL_Event &event)
{
if (enabled_)
if (enabled_ && event.type == SDL_CONTROLLERBUTTONDOWN)
{
SDL_Event event;
// Comprueba los eventos que hay en la cola
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
{
section::name = section::Name::QUIT;
section::options = section::Options::QUIT_WITH_KEYBOARD;
break;
}
case SDL_CONTROLLERBUTTONDOWN:
{
doControllerButtonDown(event.cbutton);
break;
}
default:
break;
}
}
doControllerButtonDown(event.cbutton);
}
}