I may do it when I am at home , the Problem we have until a nicer solution is found, that both players have to put their fingers on the screen at the saem time
Hi Eoinoc,
sorry for my late response. Attached you'll find PenTrac.dll (and the source code) and my little DemoApp. To test this multitouch approach:
- copy PenTrac.dll to /windows
- set reg value "HKLM\HARDWARE\DEVICEMAP\TOUCH\MultiTouchDemo" to "1"
touch.dll now loads PenTrac.dll and you'll see the following debug output (NKDbgPrintfW()):
[PenTrac] DllMain()
[PenTrac] Initialize...
- copy MultiTouchDemo.exe to the target and start it
The last days I tried to "find" the 3rd finger . Internally touch.dll can recognize 3 fingers on the screen, but I didn't find the values for the 3rd pos. When 3 fingers are on the screen, touch.dll forces this to a 2 finger input.
Auto alignment is also a problem. It seems that touch.dll gets the aligned values from the psoc. I tried to manipulate this behaviour with the reg value "HWMode". If bit 4 is, set the psoc changes to another mode where x-axis alignment is different (the values are swapped - you can test it with the DemoApp), but auto alignment is still activated. :-( Do you have another idea?
Interesting is also the reg value "PsocDebugMode". When activated, the driver prints the following messages:
[D:TP] tp_debug: [15]6400;[16]3097;[37]8707;[58]8959;[61]65535;[70]65535;[82]65535;[105]65535;[126]65535;[129]65535;[151]65535;[152]65535.
[D:TP] tp_debug: [15]8704;[16]3874;[37]8707;[58]8959;[61]65535;[70]65535;[82]65535;[105]65535;[126]65535;[129]65535;[151]65535;[152]65535.
The output changes with different finger positions, but how to interpret these values?
Another question: Is in the new TMOB ROM 2.01 a new touch.dll integrated? And are there different reg values under
"HKLM\HARDWARE\DEVICEMAP\TOUCH\" or
"HKLM\HARDWARE\Setting\TouchPanel?
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public struct MouseState
{
public Point Position;
public bool MouseDown;
}
public MouseState[] Fingers = new MouseState[3];
public void frmMain_MouseDown(object sender, MouseEventArgs e)
{
label1.Text = "MouseDown!";
int ButtonID = (int)(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = true;
}
public void frmMain_MouseMove(object sender, MouseEventArgs e)
{
label1.Text = "Moving";
int ButtonID = (int)(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = true;
}
public void frmMain_MouseUp(object sender, MouseEventArgs e)
{
label1.Text = "Up!";
int ButtonID = (int)(this.ButtonToID(e.Button));
this.Fingers[ButtonID].Position.X = e.X;
this.Fingers[ButtonID].Position.Y = e.Y;
this.Fingers[ButtonID].MouseDown = false;
}
private object ButtonToID(MouseButtons MouseButton)
{
if ((MouseButton == MouseButtons.None) | (MouseButton == MouseButtons.Left))
{
return 0;
}
if (MouseButton == MouseButtons.Middle)
{
return 1;
}
return 2;
}
private void Form1_Load(object sender, EventArgs e)
{
SciLorsMultiTouch.SciLorsMultiTouch myMultiTouch = new SciLorsMultiTouch.SciLorsMultiTouch();
myMultiTouch.CatchWndProc(this, 0, 0);
myMultiTouch.MouseDown+=new SciLorsMultiTouch.SciLorsMultiTouch.MouseDownEventHandler(frmMain_MouseDown);
myMultiTouch.MouseMove += new SciLorsMultiTouch.SciLorsMultiTouch.MouseMoveEventHandler(frmMain_MouseMove);
myMultiTouch.MouseUp += new SciLorsMultiTouch.SciLorsMultiTouch.MouseUpEventHandler(frmMain_MouseUp);
}
}
SciLorsMultiTouch.SciLorsMultiTouch myMultiTouch = new SciLorsMultiTouch.SciLorsMultiTouch();
Do you press both Fingers on the Screen at the same time(Put them down at the same time)?
I do not know if the attaching of the events is right, I have just translated that with a tool. Maybe there is a problem?
Edit:
cannot be in the load procedure. the declaration of "myMultitouch" must be like " public MouseState[] Fingers = new MouseState[3];" outside of the procedures. Otherwise the "myMultiTouch"-Class gets disposed automaticly!Code:SciLorsMultiTouch.SciLorsMultiTouch myMultiTouch = new SciLorsMultiTouch.SciLorsMultiTouch();
The problem is, that I use the standard "pinch-to-zoom". And that works that way.
Good Night
Alright, good night!
A question for you when you wake up:
Is it possible for an app using this dll to run in the background and listen for gestures in general?
Hi yngvebn,
"Is it possible for an app using this dll to run in the background and listen for gestures in general?"
You can do this with the "Pentrac.dll" approach: The dll is already a background listener for the touch values. You could extend the dll to recognize/process gestures...
Hi.
I downloaded the Zip with the DLL to support multitouch on HD2.
The Zip file contains a 3MB text file, named KillMe.txt.
The content of this file is pretty much "garbage" text.
Im curious about why it is there . . .
Why make a 3 MB file when you could save the space with uploading a much smaller file.
Do not mind about it, it is just therefore that I can gain some points on that uploading service(So everybody who uses my software, give something back to me). Just ignore it