From ca6475699003bb439450cdad0471e4ae9b432f55 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 15 Sep 2020 10:40:46 -0700 Subject: AppBase: added IsReady method --- NativeApp/src/Win32/WinMain.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'NativeApp/src/Win32/WinMain.cpp') 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()); + } } } -- cgit v1.2.3