diff --git a/bin/OpenLara.exe b/bin/OpenLara.exe
index ae1da41..1856fa2 100644
Binary files a/bin/OpenLara.exe and b/bin/OpenLara.exe differ
diff --git a/src/win/OpenLara.vcxproj b/src/win/OpenLara.vcxproj
index 6f9e84c..187c746 100644
--- a/src/win/OpenLara.vcxproj
+++ b/src/win/OpenLara.vcxproj
@@ -75,7 +75,7 @@
Full
true
true
- STB_VORBIS_NO_STDIO;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ MINIMAL;STB_VORBIS_NO_STDIO;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
false
false
MultiThreaded
@@ -86,8 +86,8 @@
true
- Console
- true
+ Windows
+ false
true
true
wcrt.lib;opengl32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
diff --git a/src/win/main.cpp b/src/win/main.cpp
index 181cb29..4126b73 100644
--- a/src/win/main.cpp
+++ b/src/win/main.cpp
@@ -1,13 +1,16 @@
#ifdef _DEBUG
#include "crtdbg.h"
#endif
-/* // VS2015 ?
-#include
-void __cdecl operator delete(void *ptr, unsigned int size) {
- //
-}
-*/
+#ifdef MINIMAL
+ #if _MSC_VER == 1900 // VS2015
+ #include
+ void __cdecl operator delete(void *ptr, unsigned int size) { free(ptr); }
+ // add "/d2noftol3" to compiler additional options
+ // add define _NO_CRT_STDIO_INLINE
+ #endif
+#endif
+
#include "game.h"
DWORD getTime() {
@@ -177,10 +180,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
PostQuitMessage(0);
break;
// keyboard
+ case WM_CHAR :
+ case WM_SYSCHAR :
+ break;
case WM_KEYDOWN :
case WM_KEYUP :
- case WM_SYSKEYDOWN :
- case WM_SYSKEYUP :
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ if (msg == WM_SYSKEYDOWN && wParam == VK_RETURN) { // switch to fullscreen or window
+ static WINDOWPLACEMENT pLast;
+ DWORD style = GetWindowLong(hWnd, GWL_STYLE);
+ if (style & WS_OVERLAPPEDWINDOW) {
+ MONITORINFO mInfo = { sizeof(mInfo) };
+ if (GetWindowPlacement(hWnd, &pLast) && GetMonitorInfo(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mInfo)) {
+ RECT &r = mInfo.rcMonitor;
+ SetWindowLong(hWnd, GWL_STYLE, style & ~WS_OVERLAPPEDWINDOW);
+ MoveWindow(hWnd, r.left, r.top, r.right - r.left, r.bottom - r.top, FALSE);
+ }
+ } else {
+ SetWindowLong(hWnd, GWL_STYLE, style | WS_OVERLAPPEDWINDOW);
+ SetWindowPlacement(hWnd, &pLast);
+ }
+ break;
+ }
Input::setDown(keyToInputKey(wParam), msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN);
break;
// mouse
@@ -240,9 +262,10 @@ void freeGL(HGLRC hRC) {
wglDeleteContext(hRC);
}
-
+#ifndef _DEBUG
+int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
+#else
int main() {
-#ifdef _DEBUG
_CrtMemState _ms;
_CrtMemCheckpoint(&_ms);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
@@ -263,7 +286,7 @@ int main() {
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)&WndProc);
ShowWindow(hWnd, SW_SHOWDEFAULT);
- DWORD time, lastTime = getTime(), fpsTime = lastTime + 1000, fps = 0;
+ DWORD lastTime = getTime(), fpsTime = lastTime + 1000, fps = 0;
MSG msg;
do {
@@ -273,7 +296,7 @@ int main() {
} else {
joyUpdate();
- time = getTime();
+ DWORD time = getTime();
if (time <= lastTime)
continue;