| 225 | } |
| 226 | |
| 227 | void AppBase::privateUpdate__() |
| 228 | { |
| 229 | mFrameCount++; |
| 230 | |
| 231 | // service asio::io_context |
| 232 | mIo->poll(); |
| 233 | |
| 234 | if( getNumWindows() > 0 ) { |
| 235 | WindowRef mainWin = getWindowIndex( 0 ); |
| 236 | if( mainWin ) |
| 237 | mainWin->getRenderer()->makeCurrentContext(); |
| 238 | } |
| 239 | |
| 240 | mSignalUpdate.emit(); |
| 241 | |
| 242 | update(); |
| 243 | |
| 244 | mTimeline->stepTo( static_cast<float>( getElapsedSeconds() ) ); |
| 245 | |
| 246 | double now = mTimer.getSeconds(); |
| 247 | if( now > mFpsLastSampleTime + mFpsSampleInterval ) { |
| 248 | //calculate average Fps over sample interval |
| 249 | uint32_t framesPassed = mFrameCount - mFpsLastSampleFrame; |
| 250 | mAverageFps = (float)(framesPassed / (now - mFpsLastSampleTime)); |
| 251 | |
| 252 | mFpsLastSampleTime = now; |
| 253 | mFpsLastSampleFrame = mFrameCount; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | void AppBase::emitCleanup() |
| 258 | { |
no test coverage detected