HWND
createWindow(int width, int height);
+void
+resizeWindow(HWND hWnd, int width, int height);
+
} /* namespace d3dretrace */
if 'hFocusWindow' in method.argNames():
print r' hFocusWindow = hWnd;'
+ if method.name in ('Reset', 'ResetEx'):
+ print r' if (pPresentationParameters->Windowed) {'
+ print r' d3dretrace::resizeWindow(pPresentationParameters->hDeviceWindow, pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);'
+ print r' }'
+
# notify frame has been completed
if method.name == 'Present':
print r' retrace::frameComplete(call);'
}
+void
+resizeWindow(HWND hWnd, int width, int height) {
+ RECT rClient;
+ GetClientRect(hWnd, &rClient);
+ if (width == rClient.right - rClient.left &&
+ height == rClient.bottom - rClient.top) {
+ return;
+ }
+
+ RECT rWindow;
+ GetWindowRect(hWnd, &rWindow);
+ width += (rWindow.right - rWindow.left) - rClient.right;
+ height += (rWindow.bottom - rWindow.top) - rClient.bottom;
+ SetWindowPos(hWnd, NULL, rWindow.left, rWindow.top, width, height, SWP_NOMOVE);
+}