-
Notifications
You must be signed in to change notification settings - Fork 15
/
TuioDump.cs
90 lines (70 loc) · 3.12 KB
/
TuioDump.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
TUIO C# Example - part of the reacTIVision project
http://reactivision.sourceforge.net/
Copyright (c) 2005-2016 Martin Kaltenbrunner <martin@tuio.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Intcur., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
using System;
using TUIO;
public class TuioDump : TuioListener
{
public void addTuioObject(TuioObject tobj) {
Console.WriteLine("add obj "+tobj.SymbolID+" "+tobj.SessionID+" "+tobj.X+" "+tobj.Y+" "+tobj.Angle);
}
public void updateTuioObject(TuioObject tobj) {
Console.WriteLine("set obj "+tobj.SymbolID+" "+tobj.SessionID+" "+tobj.X+" "+tobj.Y+" "+tobj.Angle+" "+tobj.MotionSpeed+" "+tobj.RotationSpeed+" "+tobj.MotionAccel+" "+tobj.RotationAccel);
}
public void removeTuioObject(TuioObject tobj) {
Console.WriteLine("del obj "+tobj.SymbolID+" "+tobj.SessionID);
}
public void addTuioCursor(TuioCursor tcur) {
Console.WriteLine("add cur "+tcur.CursorID + " ("+tcur.SessionID+") "+tcur.X+" "+tcur.Y);
}
public void updateTuioCursor(TuioCursor tcur) {
Console.WriteLine("set cur "+tcur.CursorID + " ("+tcur.SessionID+") "+tcur.X+" "+tcur.Y+" "+tcur.MotionSpeed+" "+tcur.MotionAccel);
}
public void removeTuioCursor(TuioCursor tcur) {
Console.WriteLine("del cur "+tcur.CursorID + " ("+tcur.SessionID+")");
}
public void addTuioBlob(TuioBlob tblb) {
Console.WriteLine("add blb "+tblb.BlobID + " ("+tblb.SessionID+") "+tblb.X+" "+tblb.Y+" "+tblb.Angle+" "+tblb.Width+" "+tblb.Height+" "+tblb.Area);
}
public void updateTuioBlob(TuioBlob tblb) {
Console.WriteLine("set blb "+tblb.BlobID + " ("+tblb.SessionID+") "+tblb.X+" "+tblb.Y+" "+tblb.Angle+" "+tblb.Width+" "+tblb.Height+" "+tblb.Area+" "+tblb.MotionSpeed+" "+tblb.RotationSpeed+" "+tblb.MotionAccel+" "+tblb.RotationAccel);
}
public void removeTuioBlob(TuioBlob tblb) {
Console.WriteLine("del blb "+tblb.BlobID + " ("+tblb.SessionID+")");
}
public void refresh(TuioTime frameTime) {
//Console.WriteLine("refresh "+frameTime.getTotalMilliseconds());
}
public static void Main(String[] argv) {
TuioDump demo = new TuioDump();
TuioClient client = null;
switch (argv.Length) {
case 1:
int port = 0;
port = int.Parse(argv[0],null);
if(port>0) client = new TuioClient(port);
break;
case 0:
client = new TuioClient();
break;
}
if (client!=null) {
client.addTuioListener(demo);
client.connect();
Console.WriteLine("listening to TUIO messages at port " + client.getPort());
} else Console.WriteLine("usage: mono TuioDump [port]");
}
}