Front IDILL :
authorbastiena
Fri, 06 Apr 2012 18:32:13 +0200
changeset 25 a7b0e40bcab0
parent 24 2bdf5d51d434
child 26 858e90c7cbaa
Front IDILL : Basic JS TUIO lib loaded
front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp
front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h
front_idill/extern/fajran-npTuioClient/npTuioClient.aps
front_idill/extern/fajran-npTuioClient/npTuioClient.sdf
front_idill/extern/fajran-npTuioClient/src/plugin.cpp
front_idill/extern/fajran-tuiojs/.gitignore
front_idill/extern/fajran-tuiojs/LICENSE.txt
front_idill/extern/fajran-tuiojs/README.md
front_idill/extern/fajran-tuiojs/connector/npTuioClient/tuiojs.npTuioClient.js
front_idill/extern/fajran-tuiojs/connector/stomp/README.md
front_idill/extern/fajran-tuiojs/connector/stomp/index.html
front_idill/extern/fajran-tuiojs/connector/stomp/orbited.cfg
front_idill/extern/fajran-tuiojs/connector/stomp/tuio-gateway.py
front_idill/extern/fajran-tuiojs/connector/stomp/tuio.stomp.js
front_idill/extern/fajran-tuiojs/examples/dump.html
front_idill/extern/fajran-tuiojs/examples/fire.html
front_idill/extern/fajran-tuiojs/examples/log.js
front_idill/extern/fajran-tuiojs/examples/paint.html
front_idill/extern/fajran-tuiojs/examples/processingjs/README.txt
front_idill/extern/fajran-tuiojs/examples/processingjs/paint.html
front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js
front_idill/extern/fajran-tuiojs/examples/tracker.html
front_idill/extern/fajran-tuiojs/src/tuio.js
--- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp	Fri Apr 06 11:48:00 2012 +0200
+++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioClient.cpp	Fri Apr 06 18:32:13 2012 +0200
@@ -189,7 +189,7 @@
 						delete *closestCursor;
 					} else maxFingerID = f_id;	
 					//Modifié par alexandre.bastien@iri.centrepompidou.fr
-					TuioCursor *addCursor = new TuioCursor((long)s_id,f_id,xpos,ypos);
+					TuioCursor *addCursor = new TuioCursor((long)s_id,f_id,xpos,ypos,zpos);
 					cursorList.push_back(addCursor);
 					
 					for (std::list<TuioListener*>::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++)
@@ -197,7 +197,7 @@
 					
 				//Modifié par alexandre.bastien@iri.centrepompidou.fr
 				} else if ( ((*tcur)->getX()!=xpos) || ((*tcur)->getY()!=ypos) || ((*tcur)->getZ()!=zpos) || ((*tcur)->getXSpeed()!=xspeed) || ((*tcur)->getYSpeed()!=yspeed) || ((*tcur)->getMotionAccel()!=maccel) ) {
-					(*tcur)->update(xpos,ypos,xspeed,yspeed,maccel);
+					(*tcur)->update(xpos,ypos,zpos,xspeed,yspeed,maccel);
 					for (std::list<TuioListener*>::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++)
 						(*listener)->updateTuioCursor((*tcur));
 				}
--- a/front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h	Fri Apr 06 11:48:00 2012 +0200
+++ b/front_idill/extern/fajran-npTuioClient/TuioClient/TuioPoint.h	Fri Apr 06 18:32:13 2012 +0200
@@ -108,22 +108,26 @@
 		return sqrtf(dx*dx+dy*dy+dz*dz);
 	}
 
+	/*
+	* Modifié par alexandre.bastien@iri.centrepompidou.fr
+	*/
 	float getDistance(TuioPoint *tuioPoint) {
 		float dx = xpos-tuioPoint->getX();
 		float dy = ypos-tuioPoint->getY();
-		return sqrtf(dx*dx+dy*dy);
-	}
-
-	/*
-	* Ajouté par alexandre.bastien@iri.centrepompidou.fr
-	*/
-	float getDistance3D(TuioPoint *tuioPoint) {
-		float dx = xpos-tuioPoint->getX();
-		float dy = ypos-tuioPoint->getY();
 		float dz = zpos-tuioPoint->getZ();
 		return sqrtf(dx*dx+dy*dy+dz*dz);
 	}
 
+	/*
+	* Modifié par alexandre.bastien@iri.centrepompidou.fr
+	*/
+	/*float getDistance3D(TuioPoint *tuioPoint) {
+		float dx = xpos-tuioPoint->getX();
+		float dy = ypos-tuioPoint->getY();
+		float dz = zpos-tuioPoint->getZ();
+		return sqrtf(dx*dx+dy*dy+dz*dz);
+	}*/
+
 	float getAngle(TuioPoint *tuioPoint) {
 		
 		float side = tuioPoint->getX()-xpos;
Binary file front_idill/extern/fajran-npTuioClient/npTuioClient.aps has changed
Binary file front_idill/extern/fajran-npTuioClient/npTuioClient.sdf has changed
--- a/front_idill/extern/fajran-npTuioClient/src/plugin.cpp	Fri Apr 06 11:48:00 2012 +0200
+++ b/front_idill/extern/fajran-npTuioClient/src/plugin.cpp	Fri Apr 06 18:32:13 2012 +0200
@@ -86,7 +86,7 @@
 
     plugInitialized = TRUE;
 
-	tuio_start(3333);
+	tuio_start(80);
 
     return NPERR_NO_ERROR;
 }
@@ -326,6 +326,7 @@
 	ss << event->data.fid << ", ";
 	ss << event->data.x << ", ";
 	ss << event->data.y << ", ";
+	ss << event->data.z << ", ";
 	ss << event->data.a << ");";
 	NPN_GetURL(event->instance, ss.str().c_str(), "_self");
 
@@ -336,7 +337,7 @@
 {
 	D("[event] callback: type=" << data.type
 		<< ", sid=" << data.sid << ", fid=" << data.fid
-		<< ", x=" << data.x << ", y=" << data.y << ", a=" << data.a);
+		<< ", x=" << data.x << ", y=" << data.y << ", z=" << data.z << ", a=" << data.a);
 
 	Event* ev = new Event();
 	ev->instance = _instance;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/.gitignore	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,3 @@
+*.swp
+*.pyc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/LICENSE.txt	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,19 @@
+Copyright (c) 2009 Fajran Iman Rusadi <fajran@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/README.md	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,15 @@
+TUIOjs
+======
+
+Javascript TUIO client library.
+
+This library uses a connector to receive the TUIO data. Currently,
+there are two connectors available:
+
+* [npTuioClient](http://github.com/fajran/npTuioClient) based
+  connector. Check it's project page to see how it works.
+
+* Stomp based connector. This connector uses XHR to get events from a
+  [Stomp](http://stomp.codehaus.org/) server.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/npTuioClient/tuiojs.npTuioClient.js	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,31 @@
+
+tuio.setConnector({
+	_failmsg: "Unable to initialize npTuioClient plugin.",
+	_id: "__tuiojs_connector_npTuioClient",
+
+	start: function() {
+		var el = document.getElementById(this._id);
+		if (el == undefined) {
+			var el = document.createElement('object');
+			el.setAttribute('id', this._id);
+			el.setAttribute('type', 'application/x-tuio');
+			el.appendChild(document.createTextNode(this._failmsg));
+			document.body.appendChild(el);
+		}
+
+		// TODO: check if the plugin can be loaded. 
+		//       if so, hide the plugin (display:none).
+	},
+
+	stop: function() {
+		var el = document.getElementById(this._id);
+		if (el != undefined) {
+			document.body.removeChild(el);
+		}
+	}
+});
+
+function tuio_callback(type, sid, fid, x, y, angle)  {
+	tuio.callback(type, sid, fid, x, y, angle);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/stomp/README.md	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,27 @@
+TUIOjs
+======
+
+A TUIO gateway for javascript.
+
+Data flow
+---------
+
+The data flow can be illustrated more or less like the following.
+
+    Tracker =[tuio]=> gateway => message queue =[stomp/http]=> browser.
+
+Requirements
+------------
+
+- [orbited](http://orbited.org/)
+- [pytuio](http://code.google.com/p/pytuio/)
+- [stompy](http://code.google.com/p/stomppy/)
+- [jquery](http://jquery.org)
+- a fast browser. Tested with safari 4 on mac os x tiger.
+
+Screencast
+----------
+
+<http://www.screencast.com/t/6ACXWUph>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/stomp/index.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,80 @@
+<html><head>
+<style type="text/css">
+.box {
+	position: absolute;
+	top: 100px;
+	left: 100px;
+	width: 20px;
+	height: 20px;
+	background: blue;
+}
+</style>
+<script type="text/javascript" src="jquery.js"></script>
+<script type="text/javascript" src="/static/Orbited.js"></script>
+<script type="text/javascript">
+
+TCPSocket = Orbited.TCPSocket;
+</script>
+<script type="text/javascript" src="/static/protocols/stomp/stomp.js"></script>
+<script type="text/javascript">
+
+var sc;
+
+function process(data) {
+	var type = data[0];
+	var action = data[1];
+	var id = parseInt(data[2]);
+	var x = parseInt(parseFloat(data[3]) * window.innerWidth);
+	var y = parseInt(parseFloat(data[4]) * window.innerHeight);
+	console.log(action);
+	if (action == "U") {
+		$('#b'+id).css({'top': y+"px", 'left': x+"px"});
+	}
+	else if (action == "N") {
+		console.log("new");
+		$('#container').append('<div class="box" id="b' + id + '"></div>');
+		$('#b'+id).css({'top': y+"px", 'left': x+"px"});
+	}
+	else if (action == "R") {
+		console.log("remove");
+		$('#b'+id).remove();
+	}
+}
+
+onload = function() {
+	console.log('onload');
+	sc = new STOMPClient();
+	sc.onopen = function() {
+		console.log("[stomp] open");
+	}
+	sc.onclose = function(code) {
+		console.log("[stomp] close: code=" + code);
+	}
+	sc.onerror = function(err) {
+		console.log("[stomp] error: " + err);
+	}
+	sc.onerrorframe = function(frame) {
+		console.log("[stomp] frame error: " + frame.body);
+	}
+	sc.onconnectedframe = function() {
+		console.log("[stomp] connected");
+		sc.subscribe('/topic/home', {exchange:''});
+	}
+	sc.onmessageframe = function(frame) {
+		console.log(frame.body);
+		process(frame.body.split(" "));
+	}
+	console.log('aa');
+	setTimeout(function() {
+		sc.connect('localhost', 61613, 'guest', 'guest');
+	}, 10);
+};
+onunload = function() {
+	sc.reset();
+}
+
+</script>
+</head><body>
+<div id="container">
+</div>
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/stomp/orbited.cfg	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,12 @@
+[listen]
+http://:9000
+stomp://:61613
+ 
+[access]
+* -> localhost:61613
+ 
+[static]
+graph=index.html
+ 
+[global]
+session.ping_interval = 300
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/stomp/tuio-gateway.py	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,58 @@
+import tuio
+import stomp
+
+s = stomp.Connection()
+s.start()
+s.connect()
+
+cnt = 0
+
+current = []
+ld = {}
+
+t = tuio.Tracking()
+try:
+	while True:
+		t.update()
+
+		active = []
+		for c in t.cursors():
+			active.append(c.sessionid)
+
+		tbr = []
+		for c in current:
+			if c not in active:
+				tbr.append(c)
+
+		tba = []
+		for c in active:
+			if c not in current:
+				tba.append(c)
+
+		current = active
+
+		for c in tbr:
+			d = ld[c]
+			# cursor removed = 5
+			s.send("5 %d %d %f %f 0" % (c, c, d[1], d[2]), destination="/topic/home")
+			ld.pop(c)
+
+		# for c in tba:
+		# 	s.send("C N %d" % c, destination="/topic/home")
+
+		for c in t.cursors():
+			data = (c.sessionid, c.sessionid, c.xpos, c.ypos)
+			if not ld.get(c.sessionid, None) == data:
+				if c.sessionid in tba:
+					# cursor new = 3
+					msg = "3 %d %d %f %f 0" % data
+				else:
+					# cursor update = 4
+					msg = "4 %d %d %f %f 0" % data
+				s.send(msg, destination="/topic/home")
+				ld[c.sessionid] = data
+				cnt += 1
+
+except KeyboardInterrupt:
+	t.stop()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/connector/stomp/tuio.stomp.js	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,49 @@
+
+tuio.setConnector({
+	_host: 'localhost',
+	_port: 61613,
+	_user: 'guest',
+	_pass: 'guest',
+	_topic: '/topic/home',
+
+	_client: undefined,
+
+	start: function() {
+		var self = this;
+		var sc = new STOMPClient();
+		self._client = sc;
+
+		sc.onopen = function() {
+		}
+		sc.onclose = function(code) {
+		}
+		sc.onerror = function(err) {
+		}
+		sc.onerrorframe = function(frame) {
+		}
+		sc.onconnectedframe = function() {
+			sc.subscribe(self._topic, {exchange:''});
+		}
+		sc.onmessageframe = function(frame) {
+			self._process(frame.body.split(" "));
+		}
+		setTimeout(function() {
+			sc.connect(self._host, self._port, self._user, self._pass);
+		}, 10);
+	},
+
+	stop: function() {
+		this._client.reset();
+	},
+
+	_process: function(data) {
+		var type = parseInt(data[0]);
+		var sid = parseInt(data[1]);
+		var fid = parseInt(data[2]);
+		var x = parseFloat(data[3]);
+		var y = parseFloat(data[4]);
+		var angle = parseFloat(data[5]);
+
+		tuio.callback(type, sid, fid, x, y, angle);
+	}
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/dump.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,48 @@
+<html><head>
+<script type="text/javascript" src="log.js"></script>
+<script type="text/javascript" src="../src/tuio.js"></script>
+<script type="text/javascript" src="../connector/npTuioClient/tuiojs.npTuioClient.js"></script>
+<script type="text/javascript">
+
+tuio.object_add(function(data) {
+	log('[object] add: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y + ', angle=' + data.angle);
+});
+
+tuio.object_update(function(data) {
+	log('[object] update: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y + ', angle=' + data.angle);
+});
+
+tuio.object_remove(function(data) {
+	log('[object] remove: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y + ', angle=' + data.angle);
+});
+
+tuio.cursor_add(function(data) {
+	log('[cursor] add: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y);
+});
+
+tuio.cursor_update(function(data) {
+	log('[cursor] update: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y);
+});
+
+tuio.cursor_remove(function(data) {
+	log('[cursor] remove: sid=' + data.sid + ', fid=' + data.fid + ', x=' + data.x + ', y=' + data.y);
+});
+
+function init() {
+	tuio.start();
+}
+
+</script>
+<body onload="init()">
+
+<script type="text/javascript">
+	if (console.log) {
+		document.write("Open your Firebug's console to see multi-touch events.");
+	}
+	else {
+		document.write('<h1>Multi-touch events</h2>');
+		document.write('<pre id="log"></pre>');
+	}
+</script>
+
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/fire.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head><title>TUIO Client plugin test</title>
+<style type="text/css">
+body { margin: 0px; overflow: hidden; }
+</style>
+<script type="text/javascript" src="../src/tuio.js"></script>
+<script type="text/javascript" src="../connector/npTuioClient/tuiojs.npTuioClient.js"></script>
+<script type="text/javascript">
+
+var canvas;
+var ctx;
+var w = 300;
+var h = 300;
+
+function updateCanvasSize() {
+	var nw = window.innerWidth;
+	var nh = window.innerHeight;
+
+	if ((w != nw) || (h != nh)) {
+		w = nw;
+		h = nh;
+		canvas.style.width = w+'px';
+		canvas.style.height = h+'px';
+		canvas.width = w;
+		canvas.height = h;
+	}
+}
+
+var img = undefined;
+
+function updateCanvas() {
+
+	if (img) {
+		ctx.putImageData(img, 0, -5);
+	}
+
+	ctx.beginPath();
+	ctx.fillStyle = "rgba(255, 255, 255, 0.15)";
+	ctx.rect(0, 0, w, h);
+	ctx.fill();
+
+	var size = tuio.cursors.length;
+	var i;
+	for (i=0; i<size; i++) {
+		var data = tuio.cursors[i];
+		var px = data.x * w;
+		var py = data.y * h;
+
+		ctx.beginPath();
+		ctx.fillStyle = "rgba(255, 64, 000, 0.4)";
+		ctx.arc(px, py, 15, 0, 2*Math.PI, true);
+		ctx.fill();
+	}
+
+	img = ctx.getImageData(0, 0, w, h);
+};
+
+function init() {
+	canvas = document.getElementById('canvas');
+	ctx = canvas.getContext('2d');
+	tuio.start();
+	updateCanvasSize();
+	setInterval(updateCanvas, 20);
+}
+
+</script>
+</head>
+<body onload="init()">
+	
+<canvas id="canvas" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/log.js	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,23 @@
+
+var logs = [];
+var max = 20;
+
+function updateLog() {
+	if (logs.length > max) {
+		logs = logs.splice(logs.length - max);
+	}
+
+	var text = logs.join("\n");
+	document.getElementById('log').innerHTML = text;
+}
+
+function log(msg) {
+	if (console.log) {
+		console.log(msg);
+	}
+	else {
+		logs.push(msg);
+		updateLog();
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/paint.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head><title>TUIO Client plugin test</title>
+<style type="text/css">
+body { margin: 0px; overflow: hidden; }
+</style>
+<script type="text/javascript" src="../src/tuio.js"></script>
+<script type="text/javascript" src="../connector/npTuioClient/tuiojs.npTuioClient.js"></script>
+<script type="text/javascript">
+
+var canvas;
+var ctx;
+var w = 300;
+var h = 300;
+
+function updateCanvasSize() {
+	var nw = window.innerWidth;
+	var nh = window.innerHeight;
+
+	if ((w != nw) || (h != nh)) {
+		w = nw;
+		h = nh;
+		canvas.style.width = w+'px';
+		canvas.style.height = h+'px';
+		canvas.width = w;
+		canvas.height = h;
+	}
+}
+
+tuio.cursor_update(function(data) {
+	var px = data.x * w;
+	var py = data.y * h;
+
+	ctx.beginPath();
+	ctx.fillStyle = "rgba(0, 0, 200, 0.2)";
+	ctx.arc(px, py, 15, 0, 2*Math.PI, true);
+	ctx.fill();
+});
+
+function init() {
+	canvas = document.getElementById('canvas');
+	ctx = canvas.getContext('2d');
+	tuio.start();
+	updateCanvasSize();
+}
+
+</script>
+</head>
+<body onload="init()">
+	
+<canvas id="canvas" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/processingjs/README.txt	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,6 @@
+Before you can start using the examples, download the processingjs and
+its initialization script first. Put them inside this directory.
+
+- http://github.com/jeresig/processing-js/raw/master/processing.js
+- http://github.com/jeresig/processing-js/raw/master/examples/init.js
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/processingjs/paint.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,34 @@
+
+<html><head>
+<script type="text/javascript" src="../../src/tuio.js"></script>
+<script type="text/javascript" src="../../connector/npTuioClient/tuiojs.npTuioClient.js"></script>
+<script type="text/javascript" src="processing.js"></script>
+<script type="text/javascript" src="tuio.processing.js"></script>
+<script type="text/javascript" src="init.js"></script>
+</head>
+<body>
+
+<script type="application/processing">
+// All Examples Written by Casey Reas and Ben Fry
+// unless otherwise stated.
+var client;
+
+void setup() {
+  size(200, 200);
+  background(102);
+  client = new tuio.TuioProcessing(this);
+}
+
+void draw() {
+  stroke(255);
+  var list = client.getTuioCursors();
+  int i, len = list.length();
+  for (i=0; i<len; i++) {
+	var o = list[i];
+	arc(o.getScreenX(width), o.getScreenY(height), 15, 15, 0, 2*PI);
+  }
+}
+
+</script><canvas width="300" height="300"></canvas>
+
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,95 @@
+
+// add hooks
+(function(){
+this.Processing.addTuioObject    = undefined;
+this.Processing.updateTuioObject = undefined;
+this.Processing.removeTuioObject = undefined;
+this.Processing.addTuioCursor    = undefined;
+this.Processing.updateTuioCursor = undefined;
+this.Processing.removeTuioCursor = undefined;
+})();
+
+(function(){
+
+var tuio = this.tuio;
+
+function wrapPath(d) {
+	var i, len = d.path.length;
+	var res = [];
+	for (i=0; i<len; i++) {
+		var pos = d.path[i];
+		res.push({
+			getX: function() { return pos[0]; },
+			getY: function() { return pos[1]; },
+
+			getScreenX: function(width) { return width * pos[0]; },
+			getScreenY: function(height) { return height * pos[1]; },
+		});
+	}
+	return res;
+}
+
+function wrapObject(d) {
+	return {
+		getSessionID: function() { return d.sid; },
+		getSymbolID: function() { return d.fid; },
+		getX: function() { return d.x; },
+		getY: function() { return d.y; },
+		getAngle: function() { return d.angle; },
+
+		getScreenX: function(width) { return width * d.x; },
+		getScreenY: function(height) { return height * d.y; },
+
+		getPath: function() { return wrapPath(d); },
+	};
+}
+
+function wrapCursor(d) {
+	return {
+		getSessionID: function() { return d.sid; },
+		getCursorId: function() { return d.fid; },
+		getX: function() { return d.x; },
+		getY: function() { return d.y; },
+
+		getScreenX: function(width) { return width * d.x; },
+		getScreenY: function(height) { return height * d.y; },
+
+		getPath: function() { return wrapPath(d); },
+	};
+}
+
+tuio.TuioProcessing = function(p) {
+	var listener = new tuio.Listener({
+		object_add:    function(d) { if (p.addTuioObject)    p.addTuioObject(wrapObject(d));    },
+		object_update: function(d) { if (p.updateTuioObject) p.updateTuioObject(wrapObject(d)); },
+		object_remove: function(d) { if (p.removeTuioObject) p.removeTuioObject(wrapObject(d)); },
+		cursor_add:    function(d) { if (p.addTuioCursor)    p.addTuioCursor(wrapCursor(d));    },
+		cursor_update: function(d) { if (p.updateTuioCursor) p.updateTuioCursor(wrapCursor(d)); },
+		cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); }
+	});
+	tuio.addListener(listener);
+	tuio.start();
+};
+
+tuio.TuioProcessing.prototype = {
+	getTuioObjects: function() {
+		var res = [];
+		var i, len = tuio.objects.length;
+		for (i=0; i<len; i++) {
+			res.push(wrapObject(tuio.objects[i]));
+		}
+		return res;
+	},
+
+	getTuioCursors: function() {
+		var res = [];
+		var i, len = tuio.cursors.length;
+		for (i=0; i<len; i++) {
+			res.push(wrapCursor(tuio.cursors[i]));
+		}
+		return res;
+	}
+};
+
+})();
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/examples/tracker.html	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html>
+<head><title>TUIO Client plugin test</title>
+<style type="text/css">
+body { margin: 0px; overflow: hidden; }
+</style>
+<script type="text/javascript" src="../src/tuio.js"></script>
+<script type="text/javascript" src="../connector/npTuioClient/tuiojs.npTuioClient.js"></script>
+<script type="text/javascript">
+
+var canvas;
+var ctx;
+var w = 0;
+var h = 0;
+
+var timer;
+var updateStarted = false;
+
+function updateCanvasSize() {
+	var nw = window.innerWidth;
+	var nh = window.innerHeight;
+
+	if ((w != nw) || (h != nh)) {
+		w = nw;
+		h = nh;
+		canvas.style.width = w+'px';
+		canvas.style.height = h+'px';
+		canvas.width = w;
+		canvas.height = h;
+	}
+}
+
+var colors = {};
+
+tuio.cursor_remove(function(data) {
+	delete colors[data.sid];
+});
+
+function update() {
+	if (updateStarted) return;
+	updateStarted = true;
+
+	ctx.clearRect(0, 0, w, h);
+
+	var i, len = tuio.cursors.length;
+	for (i=0; i<len; i++) {
+		var obj = tuio.cursors[i];
+		var x = obj.x;
+		var y = obj.y;
+		var px = x * w;
+		var py = y * h;
+
+		ctx.beginPath();
+		ctx.arc(px, py, 20, 0, 2*Math.PI, true);
+
+		var r, g, b;
+		if (colors[obj.sid] == undefined) {
+			r = parseInt(Math.random() * 255);
+			g = parseInt(Math.random() * 255);
+			b = parseInt(Math.random() * 255);
+			colors[obj.sid] = [r, g, b];
+		}
+
+		var c = colors[obj.sid];
+
+		ctx.fillStyle = "rgba("+c[0]+", "+c[1]+", "+c[2]+", 0.2)";
+		ctx.fill();
+
+		ctx.lineWidth = 5.0;
+		ctx.strokeStyle = "rgba(0, 0, 0, 0.7)";
+		ctx.stroke();
+	}
+
+	updateStarted = false;
+}
+
+function init() {
+	canvas = document.getElementById('canvas');
+	ctx = canvas.getContext('2d');
+	updateCanvasSize();
+	timer = setInterval(update, 15);
+	tuio.start();
+};
+
+</script>
+</head>
+<body onload="init()">
+	
+<canvas id="canvas" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_idill/extern/fajran-tuiojs/src/tuio.js	Fri Apr 06 18:32:13 2012 +0200
@@ -0,0 +1,148 @@
+
+(function() {
+	var TUIO = function() {
+		// Listener class
+
+		this.Listener = function(impl) {
+			if (impl != undefined) {
+				// override original method implementation
+				for (var key in impl) {
+					this[key] = impl[key];
+				}
+			}
+		}
+		this.Listener.prototype = {
+			object_add:    function(data) { },
+			object_update: function(data) { },
+			object_remove: function(data) { },
+			cursor_add:    function(data) { },
+			cursor_update: function(data) { },
+			cursor_remove: function(data) { }
+		}
+
+		// Instance variables
+
+		this.objects = [];
+		this.cursors = [];
+
+		this._data = {};
+
+		this._default_listener = new this.Listener();
+		this._listeners = [this._default_listener];
+
+		this._connector = undefined;
+
+	};
+	TUIO.prototype = {
+		start: function(name) {
+			var c = this._connector;
+			if (c != undefined) {
+				if (c.start != undefined) {
+					c.start();
+				}
+			}
+		},
+
+		stop: function() {
+			var c = this._connector;
+			if (c != undefined) {
+				if (c.stop != undefined) {
+					c.stop();
+				}
+			}
+		},
+
+		setConnector: function(connector) {
+			this._connector = connector;
+		},
+		
+		addListener: function(listener) {
+			this._listeners.push(listener);
+		},
+		removeListener: function(listener) {
+			this._listeners.splice(this._listeners.indexOf(listener), 1);
+		},
+
+		_invoke: function(method, data) {
+			var i, len = this._listeners.length;
+			for (i=0; i<len; i++) {
+				var listener = this._listeners[i];
+				listener[method](data);
+			}
+		},
+
+		callback: function(type, sid, fid, x, y, angle) {
+			var data;
+			
+			if ((type != 0) && (type != 3)) {
+				data = this._data[sid];
+			}
+			else {
+				data = {
+					sid: sid,
+					fid: fid,
+					path: []
+				}
+				this._data[sid] = data;
+			}
+
+			data.path.push([x, y]);
+	
+			data.x = x;
+			data.y = y;
+			
+			if (type < 3) {
+				data.angle = angle;
+			}
+	
+			switch (type) {
+				case 0: 
+					this.objects.push(data);
+					this._invoke('object_add', data);
+					break;
+	
+				case 1: 
+					this._invoke('object_update', data);
+					break;
+	
+				case 2: 
+					this.objects.splice(this.objects.indexOf(data), 1);
+					this._invoke('object_remove', data);
+					break;
+	
+				case 3: 
+					this.cursors.push(data);
+					this._invoke('cursor_add', data);
+					break;
+	
+				case 4: 
+					this._invoke('cursor_update', data);
+					break;
+	
+				case 5: 
+					this.cursors.splice(this.cursors.indexOf(data), 1);
+					this._invoke('cursor_remove', data);
+					break;
+	
+				default:
+					break;
+			}
+	
+			if ((type == 2) || (type == 5)) {
+				delete this._data[sid];
+			}
+		},
+
+		// Convenient callbacks set
+
+		object_add:    function(f) { this._default_listener.object_add = f;    },
+		object_update: function(f) { this._default_listener.object_update = f; },
+		object_remove: function(f) { this._default_listener.object_remove = f; },
+		cursor_add:    function(f) { this._default_listener.cursor_add = f;    },
+		cursor_update: function(f) { this._default_listener.cursor_update = f; },
+		cursor_remove: function(f) { this._default_listener.cursor_remove = f; }
+
+	};
+	this.tuio = new TUIO(); 
+})();
+