diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-09-15 17:40:46 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-09-15 17:40:46 +0000 |
| commit | ca6475699003bb439450cdad0471e4ae9b432f55 (patch) | |
| tree | 8ae85addf2401596160245c7b28d6d5f2ba291b1 /NativeApp/src/Win32/WinMain.cpp | |
| parent | Fixed iOS build error (diff) | |
| download | DiligentTools-ca6475699003bb439450cdad0471e4ae9b432f55.tar.gz DiligentTools-ca6475699003bb439450cdad0471e4ae9b432f55.zip | |
AppBase: added IsReady method
Diffstat (limited to 'NativeApp/src/Win32/WinMain.cpp')
| -rw-r--r-- | NativeApp/src/Win32/WinMain.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/NativeApp/src/Win32/WinMain.cpp b/NativeApp/src/Win32/WinMain.cpp index 62b206f..a5a3f76 100644 --- a/NativeApp/src/Win32/WinMain.cpp +++ b/NativeApp/src/Win32/WinMain.cpp @@ -124,18 +124,21 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow) auto ElapsedTime = CurrTime - PrevTime; PrevTime = CurrTime; - g_pTheApp->Update(CurrTime, ElapsedTime); + if (g_pTheApp->IsReady()) + { + g_pTheApp->Update(CurrTime, ElapsedTime); - g_pTheApp->Render(); + g_pTheApp->Render(); - g_pTheApp->Present(); + g_pTheApp->Present(); - double filterScale = 0.2; - filteredFrameTime = filteredFrameTime * (1.0 - filterScale) + filterScale * ElapsedTime; - std::stringstream fpsCounterSS; - fpsCounterSS << AppTitle << " - " << std::fixed << std::setprecision(1) << filteredFrameTime * 1000; - fpsCounterSS << " ms (" << 1.0 / filteredFrameTime << " fps)"; - SetWindowTextA(wnd, fpsCounterSS.str().c_str()); + double filterScale = 0.2; + filteredFrameTime = filteredFrameTime * (1.0 - filterScale) + filterScale * ElapsedTime; + std::stringstream fpsCounterSS; + fpsCounterSS << AppTitle << " - " << std::fixed << std::setprecision(1) << filteredFrameTime * 1000; + fpsCounterSS << " ms (" << 1.0 / filteredFrameTime << " fps)"; + SetWindowTextA(wnd, fpsCounterSS.str().c_str()); + } } } |
