Beispiel #1
0
void SDLEventReader::closeDevices()
{
    if (sdlIsOpen)
    {
        if (joysticks)
        {
            QMapIterator<SDL_JoystickID, InputDevice*> iter(*joysticks);
            while (iter.hasNext())
            {
                iter.next();
                InputDevice *current = iter.value();
                current->closeSDLDevice();
            }
        }
    }
}
Beispiel #2
0
void SDLEventReader::closeSDL()
{
    SDL_Event event;

    QMapIterator<SDL_JoystickID, InputDevice*> iter(*joysticks);
    while (iter.hasNext())
    {
        iter.next();
        InputDevice *current = iter.value();
        current->closeSDLDevice();
    }

    // Clear any pending events
    while (SDL_PollEvent(&event) > 0)
    {
    }
    SDL_Quit();

    sdlIsOpen = false;

    emit sdlClosed();
}