void XcbEventLoop::run() { xcb_generic_event_t *e; thread::CancellationTokenHandle handle(*token); while((e = pollForEvents(workMutex, work, requests, connection, handle)) != nullptr) { std::unique_ptr<xcb_generic_event_t, void (*)(void *)> event( e, std::free); } }
void BuriedEngine::yield() { // A cut down version of the Win16 yield function. Win32 handles this // asynchronously, which we don't want. Only needed for internal event loops. // Mark us that we're yielding so we can't save or load in a synchronous sequence _yielding = true; updateVideos(); pollForEvents(); // We don't send messages any messages from here. Otherwise, this is the same // as our main loop. _gfx->updateScreen(); _system->delayMillis(10); _yielding = false; }
void* events (void *eventsArg) { pollForEvents(static_cast<EventsArg*>(eventsArg)); return NULL; }
Common::Error BuriedEngine::run() { _console = new BuriedConsole(this); #ifndef USE_ICONV // The Japanese version needs iconv support if (getLanguage() == Common::JA_JPN) return Common::Error(Common::kUnknownError, "No iconv support available"); #endif if (isTrueColor()) { initGraphics(640, 480, true, 0); if (_system->getScreenFormat().bytesPerPixel == 1) return Common::kUnsupportedColorMode; } else { initGraphics(640, 480, true); } if (isWin95()) { _mainEXE = new DatabasePE(); _library = new DatabasePE(); } else if (isCompressed()) { _mainEXE = new DatabaseNECompressed(); _library = new DatabaseNECompressed(); } else { _mainEXE = new DatabaseNE(); // Demo only uses the main EXE if (!isDemo()) _library = new DatabaseNE(); } if (!_mainEXE->load(getEXEName())) error("Failed to load main EXE '%s'", getEXEName().c_str()); if (_library && !_library->load(getLibraryName())) error("Failed to load library DLL '%s'", getLibraryName().c_str()); syncSoundSettings(); _gfx = new GraphicsManager(this); _sound = new SoundManager(this); _mainWindow = new FrameWindow(this); _mainWindow->showWindow(Window::kWindowShow); if (isDemo()) { ((FrameWindow *)_mainWindow)->showTitleSequence(); ((FrameWindow *)_mainWindow)->showMainMenu(); } else { bool doIntro = true; if (ConfMan.hasKey("save_slot")) { uint32 gameToLoad = ConfMan.getInt("save_slot"); doIntro = (loadGameState(gameToLoad).getCode() != Common::kNoError); // If the trial version tries to load a game without a time // zone that's part of the trial version, force the intro. if (isTrial() && !((FrameWindow *)_mainWindow)->getMainChildWindow()) doIntro = true; } // Play the intro only if we're starting from scratch if (doIntro) ((FrameWindow *)_mainWindow)->showClosingScreen(); } while (!shouldQuit()) { updateVideos(); pollForEvents(); sendAllMessages(); _gfx->updateScreen(); _system->delayMillis(10); } return Common::kNoError; }