mSurfaceWidth( surfaceWidth ),
mSurfaceHeight( surfaceHeight ),
mFrame( 0u ),
- mDpi( horizontalDpi, verticalDpi )
+ mDpi( horizontalDpi, verticalDpi ),
+ mLastVSyncTime(0u)
{
Initialize();
}
mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
}
-bool TestApplication::Render( unsigned int intervalMilliseconds )
+void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
{
- // Update Time values
- mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
unsigned int seconds(0u), microseconds(0u);
mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+ mLastVSyncTime = ( seconds * 1e3 ) + ( microseconds / 1e3 );
+ unsigned int nextVSyncTime = mLastVSyncTime + 16;
+
+ // Update Time values
+ mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
+
+ float elapsedSeconds = intervalMilliseconds / 1e3f;
+ mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+}
- mCore->VSync( mFrame, seconds, microseconds );
- mCore->Update( mStatus );
+bool TestApplication::Render( unsigned int intervalMilliseconds )
+{
+ DoUpdate( intervalMilliseconds );
mCore->Render( mRenderStatus );
mFrame++;
bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds )
{
- // Update Time values
- mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
- unsigned int seconds(0u), microseconds(0u);
- mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
-
- mCore->VSync( mFrame, seconds, microseconds );
- mCore->Update( mStatus );
-
+ DoUpdate( intervalMilliseconds );
return mStatus.KeepUpdating();
}