static void SCREEN_ShutdownVideo() { if (video_texture) { SDL_DestroyTexture (video_texture); video_texture = NULL; } if (video_renderer) { SDL_DestroyRenderer (video_renderer); video_renderer = NULL; } if (video_surface) { #if !defined(VS_WIN8) && !defined(__APPLE__) SDL_FreeSurface(video_surface); #endif video_surface = NULL; } if (video_window) { SDL_DestroyWindow (video_window); video_window = NULL; } #if !defined(ANDROID) || !defined(WINPHONE) SDL_DelEventWatch (SCREEN_EventWatch, NULL); #endif video_flags = 0; }
FDeviceSDL::~FDeviceSDL() { UE_LOG(JoystickPluginLog, Log, TEXT("DeviceSDL Closing")); for (auto & Device : Devices) { RemoveDevice(Device.Key); } SDL_DelEventWatch(HandleSDLEvent, this); if (bOwnsSDL) { SDL_Quit(); } }
/** * @brief Adds and deletes an event watch function with userdata * * @sa http://wiki.libsdl.org/moin.cgi/SDL_AddEventWatch * @sa http://wiki.libsdl.org/moin.cgi/SDL_DelEventWatch * */ int events_addDelEventWatchWithUserdata(void *arg) { SDL_Event event; /* Create user event */ event.type = SDL_USEREVENT; event.user.code = SDLTest_RandomSint32(); event.user.data1 = (void *)&_userdataValue1; event.user.data2 = (void *)&_userdataValue2; /* Enable userdata check and set a value to check */ _userdataCheck = 1; _userdataValue = SDLTest_RandomIntegerInRange(-1024, 1024); /* Reset event filter call tracker */ _eventFilterCalled = 0; /* Add watch */ SDL_AddEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue); SDLTest_AssertPass("Call to SDL_AddEventWatch()"); /* Push a user event onto the queue and force queue update */ SDL_PushEvent(&event); SDLTest_AssertPass("Call to SDL_PushEvent()"); SDL_PumpEvents(); SDLTest_AssertPass("Call to SDL_PumpEvents()"); SDLTest_AssertCheck(_eventFilterCalled == 1, "Check that event filter was called"); /* Delete watch */ SDL_DelEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue); SDLTest_AssertPass("Call to SDL_DelEventWatch()"); /* Push a user event onto the queue and force queue update */ _eventFilterCalled = 0; SDL_PushEvent(&event); SDLTest_AssertPass("Call to SDL_PushEvent()"); SDL_PumpEvents(); SDLTest_AssertPass("Call to SDL_PumpEvents()"); SDLTest_AssertCheck(_eventFilterCalled == 0, "Check that event filter was NOT called"); return TEST_COMPLETED; }
/* * Quit the controller subsystem */ void SDL_GameControllerQuit(void) { ControllerMapping_t *pControllerMap; while (SDL_gamecontrollers) { SDL_gamecontrollers->ref_count = 1; SDL_GameControllerClose(SDL_gamecontrollers); } while (s_pSupportedControllers) { pControllerMap = s_pSupportedControllers; s_pSupportedControllers = s_pSupportedControllers->next; SDL_free(pControllerMap->name); SDL_free(pControllerMap->mapping); SDL_free(pControllerMap); } SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); }
Engine::~Engine() { _window.reset(); // explicit delete SDL_DelEventWatch(Engine::_watch, nullptr); SDL_Quit(); }