summaryrefslogtreecommitdiffstats
path: root/NativeApp/src/Win32/WinMain.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-25 22:30:37 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-25 22:30:37 +0000
commit3e16116fd369ad3cf3600b2c3015daa3cea80e63 (patch)
treee017f42ef7275147e71c3a19427ebcb0cce8e358 /NativeApp/src/Win32/WinMain.cpp
parentRenamed UintTests folder to Tests (diff)
downloadDiligentTools-3e16116fd369ad3cf3600b2c3015daa3cea80e63.tar.gz
DiligentTools-3e16116fd369ad3cf3600b2c3015daa3cea80e63.zip
Native app: added gloden image processing
Diffstat (limited to 'NativeApp/src/Win32/WinMain.cpp')
-rw-r--r--NativeApp/src/Win32/WinMain.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/NativeApp/src/Win32/WinMain.cpp b/NativeApp/src/Win32/WinMain.cpp
index 63dd01c..3545c53 100644
--- a/NativeApp/src/Win32/WinMain.cpp
+++ b/NativeApp/src/Win32/WinMain.cpp
@@ -23,6 +23,8 @@
#include <memory>
#include <iomanip>
+#include <iostream>
+
#include <Windows.h>
#include <crtdbg.h>
#include "NativeAppBase.h"
@@ -72,13 +74,26 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, instance, NULL);
if (!wnd)
{
- MessageBoxA(NULL, "Cannot create window", "Error", MB_OK | MB_ICONERROR);
- return 0;
+ std::cerr << "Failed to create a window";
+ return 1;
+ }
+
+ g_pTheApp->OnWindowCreated(wnd, WindowWidth, WindowHeight);
+
+ auto GoldenImgMode = g_pTheApp->GetGoldenImageMode();
+ if (GoldenImgMode != NativeAppBase::GoldenImageMode::None)
+ {
+ g_pTheApp->Update(0, 0);
+ g_pTheApp->Render();
+ g_pTheApp->Present();
+ auto ExitCode = g_pTheApp->GetExitCode();
+ g_pTheApp.reset();
+ return ExitCode;
}
+
ShowWindow(wnd, cmdShow);
UpdateWindow(wnd);
- g_pTheApp->OnWindowCreated(wnd, WindowWidth, WindowHeight);
AppTitle = g_pTheApp->GetAppTitle();
Diligent::Timer Timer;