From 98daf18d5629ed2bba4d28a11e151dc21863456d Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 16 Apr 2013 21:12:55 +0200 Subject: [PATCH] Add skeleton code for Windows multitouch, to be filled in by someone who can test :P --- GPU/GPUCommon.cpp | 1 - UI/MenuScreens.cpp | 1 + Windows/WndMainWindow.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 43c0eff6f9..e06676373c 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -531,7 +531,6 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) { auto &stackEntry = currentList->stack[--currentList->stackptr]; gstate_c.offsetAddr = stackEntry.offsetAddr; u32 target = (currentList->pc & 0xF0000000) | (stackEntry.pc & 0x0FFFFFFF); - //target = (target + gstate_c.originAddr) & 0xFFFFFFF; UpdateCycles(currentList->pc, target - 4); currentList->pc = target - 4; if (!Memory::IsValidAddress(currentList->pc)) { diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 78bf5a242b..9f2484fb8a 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -685,6 +685,7 @@ static const char * credits[] = { "soywiz", "kovensky", "xele", + "cinaera", "", "Written in C++ for speed and portability", "", diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 1fe4d5f6f9..a51342c566 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -38,6 +38,8 @@ #include "XPTheme.h" #endif +#define ENABLE_TOUCH 0 + static BOOL g_bFullScreen = FALSE; static RECT g_normalRC = {0}; @@ -209,6 +211,10 @@ namespace MainWindow //accept dragged files DragAcceptFiles(hwndMain, TRUE); +#if ENABLE_TOUCH + RegisterTouchWindow(hwndDisplay, TWF_WANTPALM); +#endif + SetFocus(hwndMain); return TRUE; @@ -304,6 +310,38 @@ namespace MainWindow } break; + case WM_TOUCH: + { + // TODO: Enabling this section will probably break things on Windows XP. + // We probably need to manually fetch pointers to GetTouchInputInfo and CloseTouchInputHandle. +#if ENABLE_TOUCH + UINT inputCount = LOWORD(wParam); + TOUCHINPUT *inputs = new TOUCHINPUT[inputCount]; + if (GetTouchInputInfo((HTOUCHINPUT)lParam, + inputCount, + inputs, + sizeof(TOUCHINPUT))) + { + for (int i = 0; i < inputCount; i++) { + // TODO: process inputs here! + + } + + if (!CloseTouchInputHandle((HTOUCHINPUT)lParam)) + { + // error handling + } + } + else + { + // GetLastError() and error handling + } + delete [] inputs; + return DefWindowProc(hWnd, message, wParam, lParam); +#endif + } + + case WM_PAINT: return DefWindowProc(hWnd, message, wParam, lParam); default: