MCPcopy Create free account
hub / github.com/cinder/Cinder / run

Method run

src/cinder/app/linux/AppImplLinuxGlfw.cpp:398–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398void AppImplLinux::run()
399{
400 mApp->privateSetup__();
401 mSetupHasBeenCalled = true;
402
403 // quit() was called from setup()
404 if( mShouldQuit )
405 goto terminate;
406
407 // issue initial app activation event
408 mApp->emitDidBecomeActive();
409
410 // isse initial resize revent
411 for( auto &window : mWindows ) {
412 window->resize();
413 }
414
415 // initialize our next frame time
416 mNextFrameTime = getElapsedSeconds();
417
418 while( ! mShouldQuit ) {
419 // update and draw
420 mApp->privateUpdate__();
421 for( auto &window : mWindows ) {
422 if( mShouldQuit ) // test for quit() issued from update() or draw()
423 goto terminate;
424 window->draw();
425 }
426
427 glfwPollEvents();
428
429 // Sleep until the next frame
430 sleepUntilNextFrame();
431
432 // Check if a window should be closed / destroyed or if we should exit.
433 auto shouldCloseWindow = [ this ] ( WindowImplLinux* window ) {
434 if( ::glfwWindowShouldClose( window->getNative() ) ) {
435 window->getWindow()->emitClose();
436 ::glfwDestroyWindow( window->getNative() );
437 return true;
438 }
439 return false;
440 };
441
442 mWindows.remove_if( shouldCloseWindow );
443 if( mWindows.empty() && mQuitOnLastWindowClosed )
444 mShouldQuit = true;
445 }
446
447 terminate:
448 mApp->emitCleanup();
449 // Destroy the main window - this should resolve to
450 // a call for ::glfwDestroyWindow( ... );
451 mMainWindow.reset();
452}
453
454WindowImplLinux* AppImplLinux::findSharedRendererWindow( const RendererRef &searchRenderer )
455{

Callers 1

launchMethod · 0.45

Calls 15

glfwPollEventsFunction · 0.85
glfwWindowShouldCloseFunction · 0.85
glfwDestroyWindowFunction · 0.85
privateSetup__Method · 0.80
emitDidBecomeActiveMethod · 0.80
privateUpdate__Method · 0.80
emitCloseMethod · 0.80
emitCleanupMethod · 0.80
getElapsedSecondsFunction · 0.50
resizeMethod · 0.45
drawMethod · 0.45
getNativeMethod · 0.45

Tested by

no test coverage detected