| 1002 | } |
| 1003 | |
| 1004 | void App::mainLoop() { |
| 1005 | mWindow->getInput()->update(); |
| 1006 | SceneManager::instance()->update(); |
| 1007 | |
| 1008 | if ( unlikely( firstUpdate ) ) { |
| 1009 | Log::info( "First update took: %.2f ms", globalClock.getElapsedTime().asMilliseconds() ); |
| 1010 | firstUpdate = false; |
| 1011 | } |
| 1012 | |
| 1013 | if ( SceneManager::instance()->getUISceneNode()->invalidated() || mBenchmarkMode ) { |
| 1014 | mWindow->clear(); |
| 1015 | SceneManager::instance()->draw(); |
| 1016 | mWindow->display(); |
| 1017 | if ( unlikely( firstFrame ) ) { |
| 1018 | Log::info( "First frame took: %.2f ms", globalClock.getElapsedTime().asMilliseconds() ); |
| 1019 | firstFrame = false; |
| 1020 | onReady(); |
| 1021 | } |
| 1022 | } else { |
| 1023 | #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN |
| 1024 | mWindow->getInput()->waitEvent( Milliseconds( mWindow->hasFocus() ? 16 : 100 ) ); |
| 1025 | #endif |
| 1026 | } |
| 1027 | |
| 1028 | if ( mBenchmarkMode && mSecondsCounter.getElapsedTime() >= Seconds( 1 ) ) { |
| 1029 | setAppTitle( mWindowTitle ); |
| 1030 | mSecondsCounter.restart(); |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | void App::onFileDropped( std::string file, bool openBinaryAsDocument ) { |
| 1035 | Vector2f mousePos( mUISceneNode->getEventDispatcher()->getMousePosf() ); |
no test coverage detected