From 7efa1036fde541ecb544fa44c32b831678aa7eb6 Mon Sep 17 00:00:00 2001 From: Ulysse Cura Date: Sat, 7 Sep 2024 18:42:49 +0200 Subject: [PATCH] Disable non-used events. --- Game.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Game.cpp b/Game.cpp index 0b8f97e..05b45b5 100644 --- a/Game.cpp +++ b/Game.cpp @@ -68,6 +68,47 @@ bool Game::Init() } cerr << "Window created successfully.\n"; + SDL_EventType disableEvents[] = { + // Événements liés aux manettes (joysticks) + SDL_JOYAXISMOTION, + SDL_JOYBALLMOTION, + SDL_JOYHATMOTION, + SDL_JOYBUTTONDOWN, + SDL_JOYBUTTONUP, + SDL_JOYDEVICEADDED, + SDL_JOYDEVICEREMOVED, + + // Événements liés aux contrôleurs (game controllers) + SDL_CONTROLLERAXISMOTION, + SDL_CONTROLLERBUTTONDOWN, + SDL_CONTROLLERBUTTONUP, + SDL_CONTROLLERDEVICEADDED, + SDL_CONTROLLERDEVICEREMOVED, + SDL_CONTROLLERDEVICEREMAPPED, + + // Événements de glisser-déposer (drag & drop) + SDL_DROPFILE, + SDL_DROPTEXT, + SDL_DROPBEGIN, + SDL_DROPCOMPLETE, + + // Événements liés aux appareils tactiles + SDL_FINGERMOTION, + SDL_FINGERDOWN, + SDL_FINGERUP, + SDL_MULTIGESTURE, + SDL_DOLLARGESTURE, + SDL_DOLLARRECORD, + + // Événements liés aux capteurs + SDL_SENSORUPDATE, + + // Événements utilisateurs (custom) + SDL_USEREVENT + }; + + for(const SDL_EventType &disableEvent : disableEvents) SDL_EventState(disableEvent, SDL_DISABLE); + renderer = SDL_CreateRenderer(m_window, -1, 0); if(renderer == NULL) {