Merge pull request #123 from keelimeguy/master
Windows Port: Adding Pen and Touch support for touch screen devices
This commit is contained in:
commit
2a58246eb5
|
@ -5171,16 +5171,41 @@ DOKEYDOWN:
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifndef WM_POINTERDOWN
|
||||||
|
#define WM_POINTERDOWN 0x0246
|
||||||
|
#endif
|
||||||
|
#ifndef WM_POINTERUPDATE
|
||||||
|
#define WM_POINTERUPDATE 0x0245
|
||||||
|
#endif
|
||||||
|
#ifndef POINTER_MESSAGE_FLAG_INCONTACT
|
||||||
|
#define POINTER_MESSAGE_FLAG_INCONTACT 0x40000
|
||||||
|
#endif
|
||||||
|
#ifndef POINTER_MESSAGE_FLAG_FIRSTBUTTON
|
||||||
|
#define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x100000
|
||||||
|
#endif
|
||||||
|
case WM_POINTERDOWN:
|
||||||
|
case WM_POINTERUPDATE:
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
if (wParam & MK_LBUTTON)
|
if (((message==WM_POINTERDOWN || message== WM_POINTERUPDATE)
|
||||||
|
&& ((wParam & (POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_FIRSTBUTTON))))
|
||||||
|
|| (message != WM_POINTERDOWN && message != WM_POINTERUPDATE && (wParam & MK_LBUTTON)))
|
||||||
{
|
{
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
|
|
||||||
s32 x = (s32)((s16)LOWORD(lParam));
|
s32 x = (s32)((s16)LOWORD(lParam));
|
||||||
s32 y = (s32)((s16)HIWORD(lParam));
|
s32 y = (s32)((s16)HIWORD(lParam));
|
||||||
|
if (message == WM_POINTERDOWN || message == WM_POINTERUPDATE)
|
||||||
|
{
|
||||||
|
POINT point;
|
||||||
|
point.x = x;
|
||||||
|
point.y = y;
|
||||||
|
ScreenToClient(hwnd, &point);
|
||||||
|
x = point.x;
|
||||||
|
y = point.y;
|
||||||
|
}
|
||||||
UnscaleScreenCoords(x,y);
|
UnscaleScreenCoords(x,y);
|
||||||
|
|
||||||
if(HudEditorMode)
|
if(HudEditorMode)
|
||||||
|
@ -5232,11 +5257,22 @@ DOKEYDOWN:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (message == WM_POINTERUPDATE
|
||||||
|
&& !(wParam & POINTER_MESSAGE_FLAG_INCONTACT | POINTER_MESSAGE_FLAG_FIRSTBUTTON))
|
||||||
|
{
|
||||||
|
ReleaseCapture();
|
||||||
|
HudClickRelease(&Hud);
|
||||||
|
}
|
||||||
if (!StylusAutoHoldPressed)
|
if (!StylusAutoHoldPressed)
|
||||||
NDS_releaseTouch();
|
NDS_releaseTouch();
|
||||||
userTouchesScreen = false;
|
userTouchesScreen = false;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifndef WM_POINTERUP
|
||||||
|
#define WM_POINTERUP 0x0247
|
||||||
|
#endif
|
||||||
|
case WM_POINTERUP:
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
|
|
Loading…
Reference in New Issue