front_processing/src/Interaction_examples/Hands_2D/Hands_2D.pde
changeset 8 e4e7db2435f8
child 9 0f44b7360c8d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_processing/src/Interaction_examples/Hands_2D/Hands_2D.pde	Thu Mar 22 16:00:17 2012 +0100
@@ -0,0 +1,48 @@
+/*
+* This file is part of the TraKERS\Front Processing package.
+*
+* (c) IRI <http://www.iri.centrepompidou.fr/>
+*
+* For the full copyright and license information, please view the LICENSE_FRONT
+* file that was distributed with this source code.
+*/
+
+/*Exemple tiré de processing.org*/
+
+import TUIO.*;
+TuioProcessing tuioClient;
+int port = 80;
+//Taille de la fenêtre
+int WIDTH = 640, HEIGHT = 480;
+
+//Coordonnées X et Y utilisées dans draw.
+int X, Y;
+
+void setup() 
+{
+  size(WIDTH, HEIGHT);
+  tuioClient = new TuioProcessing(this, port);
+  noStroke();
+  rectMode(CENTER);
+}
+
+void draw() 
+{   
+  background(51); 
+  fill(255, 204);
+  tuioInput();
+  rect(X, height/2, Y/2+10, Y/2+10);
+  fill(255, 204);
+  int inverseX = width-X;
+  int inverseY = height-Y;
+  rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
+}
+
+/*MET A JOUR X et Y
+Entrée : Les positions d'un point 2D
+Sortie : Met à jour X et Y*/
+void update(int x, int y)
+{
+  X = x;
+  Y = y;
+}