int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); if ( ! initInstance() || !applicationDidFinishLaunching() ) { return 0; } int64 updateTime = s3eTimerGetMs(); while (!s3eDeviceCheckQuitRequest()) { int64 currentTime = s3eTimerGetMs(); if (currentTime - updateTime > m_nAnimationInterval) { updateTime = currentTime; s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); CCDirector::sharedDirector()->mainLoop(); } else { s3eDeviceYield(0); } } return -1; }
int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); s3eBool quitRequested = 0; bool bNeedQuit = false; if (!applicationDidFinishLaunching() ) { return 0; } uint64 updateTime = 0 ; while (true) { updateTime = s3eTimerGetMs(); s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); quitRequested = s3eDeviceCheckQuitRequest(); if( quitRequested) { CCDirector* pDirector = CCDirector::sharedDirector(); // if opengl view has been released, delete the director. if (pDirector->getOpenGLView() == NULL) { CC_SAFE_DELETE(pDirector); bNeedQuit = true; } else { pDirector->end(); } } if( bNeedQuit ) { break; } CCDirector::sharedDirector()->mainLoop(); while ((s3eTimerGetMs() - updateTime) < m_nAnimationInterval) { int32 yield = (int32) (m_nAnimationInterval - (s3eTimerGetMs() - updateTime)); if (yield<0) break; s3eDeviceYield(yield); } } return -1; }
int CCApplication::Run() { IW_CALLSTACK("CCApplication::Run"); s3eBool quitRequested = 0; if ( ! initInstance() || !applicationDidFinishLaunching() ) { return 0; } int64 updateTime = s3eTimerGetMs(); while (true) { int64 currentTime = s3eTimerGetMs(); if (currentTime - updateTime > m_nAnimationInterval) { updateTime = currentTime; s3eDeviceYield(0); s3eKeyboardUpdate(); s3ePointerUpdate(); ccAccelerationUpdate(); quitRequested = s3eDeviceCheckQuitRequest() ; if( quitRequested && CCDirector::sharedDirector()->getOpenGLView() != NULL ) { CCDirector::sharedDirector()->end() ; // end status will be processed in CCDirector::sharedDirector()->mainLoop(); } CCDirector::sharedDirector()->mainLoop(); if( quitRequested ) { break ; } } else { s3eDeviceYield(0); } } return -1; }