summaryrefslogtreecommitdiffstats
path: root/Projects/Asteroids/src/WinWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/Asteroids/src/WinWrapper.cpp')
-rw-r--r--Projects/Asteroids/src/WinWrapper.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/Projects/Asteroids/src/WinWrapper.cpp b/Projects/Asteroids/src/WinWrapper.cpp
index 036b205..6b0ecfe 100644
--- a/Projects/Asteroids/src/WinWrapper.cpp
+++ b/Projects/Asteroids/src/WinWrapper.cpp
@@ -142,28 +142,28 @@ LRESULT CALLBACK WindowProc(
UINT ww = LOWORD(lParam);
UINT wh = HIWORD(lParam);
- // Ignore resizing to minimized
- if (ww == 0 || wh == 0) return 0;
-
gSettings.windowWidth = (int)ww;
gSettings.windowHeight = (int)wh;
gSettings.renderWidth = (UINT)(double(gSettings.windowWidth) * gSettings.renderScale);
gSettings.renderHeight = (UINT)(double(gSettings.windowHeight) * gSettings.renderScale);
// Update camera projection
- float aspect = (float)gSettings.renderWidth / (float)gSettings.renderHeight;
- gCamera.Projection(XM_PIDIV2 * 0.8f * 3 / 2, aspect);
+ if(gSettings.renderWidth !=0 && gSettings.renderHeight !=0)
+ {
+ float aspect = (float)gSettings.renderWidth / (float)gSettings.renderHeight;
+ gCamera.Projection(XM_PIDIV2 * 0.8f * 3 / 2, aspect);
+ }
// Resize currently active swap chain
switch (gSettings.mode)
{
case Settings::RenderMode::NativeD3D11:
- if(gWorkloadD3D11)
+ if(gWorkloadD3D11 && gSettings.renderWidth !=0 && gSettings.renderHeight !=0)
gWorkloadD3D11->ResizeSwapChain(gDXGIFactory, hWnd, gSettings.renderWidth, gSettings.renderHeight);
break;
case Settings::RenderMode::NativeD3D12:
- if(gWorkloadD3D12)
+ if(gWorkloadD3D12 && gSettings.renderWidth !=0 && gSettings.renderHeight !=0)
gWorkloadD3D12->ResizeSwapChain(gDXGIFactory, hWnd, gSettings.renderWidth, gSettings.renderHeight);
break;
@@ -284,6 +284,14 @@ LRESULT CALLBACK WindowProc(
}
return 0;
}
+
+ case WM_GETMINMAXINFO:
+ {
+ LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
+ lpMMI->ptMinTrackSize.x = 320;
+ lpMMI->ptMinTrackSize.y = 240;
+ return 0;
+ }
default:
return DefWindowProc(hWnd, message, wParam, lParam);