Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Process window events on d3dretrace.

  • Loading branch information...
commit 0a02e6f34097b3387c7e5cbecff6d3e8e12e2135 1 parent 0dd1f3d
@jrfonseca jrfonseca authored
View
3  retrace/d3dretrace.hpp
@@ -53,6 +53,9 @@ createWindow(int width, int height);
void
resizeWindow(HWND hWnd, int width, int height);
+bool
+processEvents(void);
+
} /* namespace d3dretrace */
View
4 retrace/d3dretrace.py
@@ -72,6 +72,10 @@ def invokeInterfaceMethod(self, interface, method):
Retracer.invokeInterfaceMethod(self, interface, method)
+ # process events after presents
+ if method.name == 'Present':
+ print r' d3dretrace::processEvents();'
+
# check errors
if str(method.type) == 'HRESULT':
print r' if (FAILED(_result)) {'
View
26 retrace/d3dretrace_ws.cpp
@@ -37,6 +37,13 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
MINMAXINFO *pMMI;
switch (uMsg) {
+ case WM_KEYDOWN:
+ switch (wParam) {
+ case VK_ESCAPE:
+ PostMessage(hWnd, WM_CLOSE, 0, 0);
+ break;
+ }
+ break;
case WM_GETMINMAXINFO:
// Allow to create a window bigger than the desktop
pMMI = (MINMAXINFO *)lParam;
@@ -45,6 +52,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
pMMI->ptMaxTrackSize.x = 60000;
pMMI->ptMaxTrackSize.y = 60000;
break;
+ case WM_CLOSE:
+ exit(0);
+ break;
default:
break;
}
@@ -121,5 +131,21 @@ resizeWindow(HWND hWnd, int width, int height) {
}
+bool
+processEvents(void) {
+ MSG uMsg;
+ while (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE)) {
+ if (uMsg.message == WM_QUIT) {
+ return false;
+ }
+
+ if (!TranslateAccelerator(uMsg.hwnd, NULL, &uMsg)) {
+ TranslateMessage(&uMsg);
+ DispatchMessage(&uMsg);
+ }
+ }
+ return true;
+}
+
} /* namespace d3dretrace */
Please sign in to comment.
Something went wrong with that request. Please try again.