MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / ProcessEvents

Method ProcessEvents

Sources/nCine/MainApplication.cpp:485–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483
484#if defined(WITH_SDL)
485 void MainApplication::ProcessEvents()
486 {
487 ZoneScoped;
488
489 SDL_Event event;
490# if !defined(DEATH_TARGET_EMSCRIPTEN)
491 if (ShouldSuspend()) {
492 SDL_WaitEvent(&event);
493 SDL_PushEvent(&event);
494 // Don't lose any events when resuming
495 while (SDL_PollEvent(&event)) {
496 SDL_PushEvent(&event);
497 }
498 }
499# endif
500
501 while (SDL_PollEvent(&event)) {
502 switch (event.type) {
503 case SDL_QUIT:
504 if (SdlInputManager::shouldQuitOnRequest()) {
505 shouldQuit_ = true;
506 }
507 break;
508 case SDL_DISPLAYEVENT:
509 gfxDevice_->updateMonitors();
510 break;
511 case SDL_WINDOWEVENT: {
512 if (SdlGfxDevice::isMainWindow(event.window.windowID)) {
513 switch (event.window.event) {
514 case SDL_WINDOWEVENT_FOCUS_GAINED:
515 SetFocus(true);
516 break;
517 case SDL_WINDOWEVENT_FOCUS_LOST:
518 SetFocus(false);
519 break;
520 case SDL_WINDOWEVENT_SIZE_CHANGED:
521 gfxDevice_->width_ = event.window.data1;
522 gfxDevice_->height_ = event.window.data2;
523 SDL_Window* windowHandle = SDL_GetWindowFromID(event.window.windowID);
524 gfxDevice_->isFullscreen_ = (SDL_GetWindowFlags(windowHandle) & SDL_WINDOW_FULLSCREEN) != 0;
525 SDL_GL_GetDrawableSize(windowHandle, &gfxDevice_->drawableWidth_, &gfxDevice_->drawableHeight_);
526 ResizeScreenViewport(gfxDevice_->drawableWidth_, gfxDevice_->drawableHeight_);
527 break;
528 }
529 }
530 break;
531 }
532 default:
533 if (appCfg_.withGraphics) {
534 SdlInputManager::parseEvent(event);
535 }
536 break;
537 }
538 }
539 }
540#elif defined(WITH_GLFW)
541 void MainApplication::ProcessEvents()
542 {

Callers 1

RunMethod · 0.45

Calls 1

updateMonitorsMethod · 0.45

Tested by

no test coverage detected