front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js
changeset 27 6c08d4d7219e
parent 26 858e90c7cbaa
child 28 9ccef81f02ab
--- a/front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js	Fri Apr 06 18:36:40 2012 +0200
+++ b/front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js	Thu Apr 12 13:09:46 2012 +0200
@@ -7,6 +7,9 @@
 this.Processing.addTuioCursor    = undefined;
 this.Processing.updateTuioCursor = undefined;
 this.Processing.removeTuioCursor = undefined;
+this.Processing.addTuioString    = undefined;
+this.Processing.updateTuioString = undefined;
+this.Processing.removeTuioString = undefined;
 })();
 
 (function(){
@@ -78,6 +81,15 @@
 	};
 }
 
+/*
+* Ajouté par alexandre.bastien@iri.centrepompidou.fr
+*/
+function wrapString(d) {
+	return {
+		getCode: function() { return d.code; },
+	};
+}
+
 tuio.TuioProcessing = function(p) {
 	var listener = new tuio.Listener({
 		object_add:    function(d) { if (p.addTuioObject)    p.addTuioObject(wrapObject(d));    },
@@ -85,7 +97,10 @@
 		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)); }
+		cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); },
+		string_add:    function(d) { if (p.addTuioString)    p.addTuioString(wrapString(d));    },
+		string_update: function(d) { if (p.updateTuioString) p.updateTuioString(wrapString(d)); },
+		string_remove: function(d) { if (p.removeTuioString) p.removeTuioString(wrapString(d)); }
 	});
 	tuio.addListener(listener);
 	tuio.start();
@@ -108,6 +123,15 @@
 			res.push(wrapCursor(tuio.cursors[i]));
 		}
 		return res;
+	},
+	
+	getTuioStrings: function() {
+		var res = [];
+		var i, len = tuio.strings.length;
+		for (i=0; i<len; i++) {
+			res.push(wrapString(tuio.strings[i]));
+		}
+		return res;
 	}
 };