front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js
changeset 27 6c08d4d7219e
parent 26 858e90c7cbaa
child 28 9ccef81f02ab
equal deleted inserted replaced
26:858e90c7cbaa 27:6c08d4d7219e
     5 this.Processing.updateTuioObject = undefined;
     5 this.Processing.updateTuioObject = undefined;
     6 this.Processing.removeTuioObject = undefined;
     6 this.Processing.removeTuioObject = undefined;
     7 this.Processing.addTuioCursor    = undefined;
     7 this.Processing.addTuioCursor    = undefined;
     8 this.Processing.updateTuioCursor = undefined;
     8 this.Processing.updateTuioCursor = undefined;
     9 this.Processing.removeTuioCursor = undefined;
     9 this.Processing.removeTuioCursor = undefined;
       
    10 this.Processing.addTuioString    = undefined;
       
    11 this.Processing.updateTuioString = undefined;
       
    12 this.Processing.removeTuioString = undefined;
    10 })();
    13 })();
    11 
    14 
    12 (function(){
    15 (function(){
    13 
    16 
    14 var tuio = this.tuio;
    17 var tuio = this.tuio;
    76 		getY: function() { return d.y; },
    79 		getY: function() { return d.y; },
    77 		getZ: function() { return d.z; },
    80 		getZ: function() { return d.z; },
    78 	};
    81 	};
    79 }
    82 }
    80 
    83 
       
    84 /*
       
    85 * Ajouté par alexandre.bastien@iri.centrepompidou.fr
       
    86 */
       
    87 function wrapString(d) {
       
    88 	return {
       
    89 		getCode: function() { return d.code; },
       
    90 	};
       
    91 }
       
    92 
    81 tuio.TuioProcessing = function(p) {
    93 tuio.TuioProcessing = function(p) {
    82 	var listener = new tuio.Listener({
    94 	var listener = new tuio.Listener({
    83 		object_add:    function(d) { if (p.addTuioObject)    p.addTuioObject(wrapObject(d));    },
    95 		object_add:    function(d) { if (p.addTuioObject)    p.addTuioObject(wrapObject(d));    },
    84 		object_update: function(d) { if (p.updateTuioObject) p.updateTuioObject(wrapObject(d)); },
    96 		object_update: function(d) { if (p.updateTuioObject) p.updateTuioObject(wrapObject(d)); },
    85 		object_remove: function(d) { if (p.removeTuioObject) p.removeTuioObject(wrapObject(d)); },
    97 		object_remove: function(d) { if (p.removeTuioObject) p.removeTuioObject(wrapObject(d)); },
    86 		cursor_add:    function(d) { if (p.addTuioCursor)    p.addTuioCursor(wrapCursor(d));    },
    98 		cursor_add:    function(d) { if (p.addTuioCursor)    p.addTuioCursor(wrapCursor(d));    },
    87 		cursor_update: function(d) { if (p.updateTuioCursor) p.updateTuioCursor(wrapCursor(d)); },
    99 		cursor_update: function(d) { if (p.updateTuioCursor) p.updateTuioCursor(wrapCursor(d)); },
    88 		cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); }
   100 		cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); },
       
   101 		string_add:    function(d) { if (p.addTuioString)    p.addTuioString(wrapString(d));    },
       
   102 		string_update: function(d) { if (p.updateTuioString) p.updateTuioString(wrapString(d)); },
       
   103 		string_remove: function(d) { if (p.removeTuioString) p.removeTuioString(wrapString(d)); }
    89 	});
   104 	});
    90 	tuio.addListener(listener);
   105 	tuio.addListener(listener);
    91 	tuio.start();
   106 	tuio.start();
    92 };
   107 };
    93 
   108 
   106 		var i, len = tuio.cursors.length;
   121 		var i, len = tuio.cursors.length;
   107 		for (i=0; i<len; i++) {
   122 		for (i=0; i<len; i++) {
   108 			res.push(wrapCursor(tuio.cursors[i]));
   123 			res.push(wrapCursor(tuio.cursors[i]));
   109 		}
   124 		}
   110 		return res;
   125 		return res;
       
   126 	},
       
   127 	
       
   128 	getTuioStrings: function() {
       
   129 		var res = [];
       
   130 		var i, len = tuio.strings.length;
       
   131 		for (i=0; i<len; i++) {
       
   132 			res.push(wrapString(tuio.strings[i]));
       
   133 		}
       
   134 		return res;
   111 	}
   135 	}
   112 };
   136 };
   113 
   137 
   114 })();
   138 })();
   115 
   139