summaryrefslogtreecommitdiffstats
path: root/Common/NativeApp/src
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-14 07:28:05 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-14 07:28:05 +0000
commite1d6dc27ec013dfecde942c7690432925ce3e23a (patch)
treea21f16fb6959c0f46394057ae65cee470674e916 /Common/NativeApp/src
parentMerge pull request #25 from kkulling/patch-1 (diff)
downloadDiligentEngine-e1d6dc27ec013dfecde942c7690432925ce3e23a.tar.gz
DiligentEngine-e1d6dc27ec013dfecde942c7690432925ce3e23a.zip
Fixed MinGW build
Diffstat (limited to 'Common/NativeApp/src')
-rw-r--r--Common/NativeApp/src/Win32/WinMain.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/Common/NativeApp/src/Win32/WinMain.cpp b/Common/NativeApp/src/Win32/WinMain.cpp
index 24777b5..62e8f40 100644
--- a/Common/NativeApp/src/Win32/WinMain.cpp
+++ b/Common/NativeApp/src/Win32/WinMain.cpp
@@ -24,6 +24,7 @@
#include <memory>
#include <iomanip>
#include <Windows.h>
+#include <crtdbg.h>
#include "NativeAppBase.h"
#include "StringTools.h"
#include "Timer.h"
@@ -40,14 +41,20 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
g_pTheApp.reset( CreateApplication() );
- const auto *cmdLine = GetCommandLineA();
+ const auto* cmdLine = GetCommandLineA();
g_pTheApp->ProcessCommandLine(cmdLine);
- std::wstring Title = Diligent::WidenString(g_pTheApp->GetAppTitle());
+ const auto* AppTitle = g_pTheApp->GetAppTitle();
+
+#ifdef UNICODE
+ const auto* const WindowClassName = L"SampleApp";
+#else
+ const auto* const WindowClassName = "SampleApp";
+#endif
// Register our window class
WNDCLASSEX wcex = { sizeof(WNDCLASSEX), CS_HREDRAW|CS_VREDRAW, MessageProc,
- 0L, 0L, instance, NULL, NULL, NULL, NULL, L"SampleApp", NULL };
+ 0L, 0L, instance, NULL, NULL, NULL, NULL, WindowClassName, NULL };
RegisterClassEx(&wcex);
// Create a window
@@ -55,12 +62,12 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
LONG WindowHeight = 1024;
RECT rc = { 0, 0, WindowWidth, WindowHeight };
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);
- HWND wnd = CreateWindow(L"SampleApp", Title.c_str(),
+ HWND wnd = CreateWindowA("SampleApp", AppTitle,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, instance, NULL);
if (!wnd)
{
- MessageBox(NULL, L"Cannot create window", L"Error", MB_OK|MB_ICONERROR);
+ MessageBoxA(NULL, "Cannot create window", "Error", MB_OK|MB_ICONERROR);
return 0;
}
ShowWindow(wnd, cmdShow);
@@ -94,10 +101,10 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int cmdShow)
double filterScale = 0.2;
filteredFrameTime = filteredFrameTime * (1.0 - filterScale) + filterScale * ElapsedTime;
- std::wstringstream fpsCounterSS;
- fpsCounterSS << " - " << std::fixed << std::setprecision(1) << filteredFrameTime * 1000;
+ std::stringstream fpsCounterSS;
+ fpsCounterSS << AppTitle << " - " << std::fixed << std::setprecision(1) << filteredFrameTime * 1000;
fpsCounterSS << " ms (" << 1.0 / filteredFrameTime << " fps)";
- SetWindowText(wnd, (Title + fpsCounterSS.str()).c_str());
+ SetWindowTextA(wnd, fpsCounterSS.str().c_str());
}
}