Yeah,
I just managed to get Windows 7 "native" Gesture support working in OpenFrameworks. (Haven't tested anything yet except the "Two finger Tap" & zooming
I guess it is more of a hack though than anything else. But than, I wouldn't consider myself a "real" or good programmer.
Anyways.
Changes:
ofConstants.h, line 42
from:
Code:
# define _WIN32_WINNT 0x400
to
Code:
#define _WIN32_WINNT 0x0601
You have to do this, otherwise WM_GESTURE won't be available. Don't know if there are any sideEffects.
Next you have to extract the attached files into
Code:
of_preRelease_v0061_vs2008_FAT\libs\openFrameworks\app\
Attachment:
File comment: taken from http://code.msdn.microsoft.com/WindowsTouch and modified.
GestureEngine.zip [4.91 KiB]
Downloaded 20 times
They are taken from
http://code.msdn.microsoft.com/WindowsTouch and modified.
I do not know about legal issues using this stuff though..
Next open up
ofAppGlutWindow.cpp and
add around line 4
Code:
#include "MyGestureEngine.h"
as well as
Code:
CMyGestureEngine * gestureEnginePtr;
below ofBaseApp * pfAppPtr (around Line 33)
next, you have to add a case statement below case WM_DESTROY:
Code:
case WM_GESTURE:
//std::cout << "Gesture caught" << std::endl;
return gestureEnginePtr->WndProc(hwnd, wParam, lParam);
The last change to this file is around line 225 (in runAppViaInfininteLoop)
add
Code:
gestureEnginePtr->setAppPointer(appPtr);
below ofAppPtr = appPtr
next, you have to adjust ofBaseApp.h
just add
Code:
virtual void twoFingerTap(){}
virtual void twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy) {}
somewhere.
You can get the changed files hier
Attachment:
File comment: Changes made
changedInOF.zip [5.43 KiB]
Downloaded 12 times
At last, you have to add
Code:
void twoFingerTap();
void twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy);
to your testApp.h and (as you all know, I guess)
Code:
void testApp::twoFingerTap(){
std::cout << "Two Fingers Tapped in TestApp.cpp" << std::endl;
}
void testApp::twoFingerZoom(double dZoomFactor,const LONG lZx,const LONG lZy){
std::cout << "Zooming with a factor of " << dZoomFactor << std::endl;
}
That's it. -- Doesn't seem that difficult now. ^^
As I said, it is far from being done and ready, however I heard "post early, post often" is the way to go

What I especially like about this solution is, that it just blends into of seamlessly.
I wouldn't now how to make an ofx.. Extension out of it.
PS: Just tested on one machine,
HP TouchSmart IQ820 with 64Bit Windows 7. It should work in 32 Bit windows 7 as well. (Not earlier Version, as WM_GESTURE then)
http://img188.imageshack.us/img188/3227/zoomandtap.png