front_processing/src/Interaction_examples/Hands_2D/Hands_2D.pde
changeset 8 e4e7db2435f8
child 9 0f44b7360c8d
equal deleted inserted replaced
7:8a21bec5d45f 8:e4e7db2435f8
       
     1 /*
       
     2 * This file is part of the TraKERS\Front Processing package.
       
     3 *
       
     4 * (c) IRI <http://www.iri.centrepompidou.fr/>
       
     5 *
       
     6 * For the full copyright and license information, please view the LICENSE_FRONT
       
     7 * file that was distributed with this source code.
       
     8 */
       
     9 
       
    10 /*Exemple tiré de processing.org*/
       
    11 
       
    12 import TUIO.*;
       
    13 TuioProcessing tuioClient;
       
    14 int port = 80;
       
    15 //Taille de la fenêtre
       
    16 int WIDTH = 640, HEIGHT = 480;
       
    17 
       
    18 //Coordonnées X et Y utilisées dans draw.
       
    19 int X, Y;
       
    20 
       
    21 void setup() 
       
    22 {
       
    23   size(WIDTH, HEIGHT);
       
    24   tuioClient = new TuioProcessing(this, port);
       
    25   noStroke();
       
    26   rectMode(CENTER);
       
    27 }
       
    28 
       
    29 void draw() 
       
    30 {   
       
    31   background(51); 
       
    32   fill(255, 204);
       
    33   tuioInput();
       
    34   rect(X, height/2, Y/2+10, Y/2+10);
       
    35   fill(255, 204);
       
    36   int inverseX = width-X;
       
    37   int inverseY = height-Y;
       
    38   rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
       
    39 }
       
    40 
       
    41 /*MET A JOUR X et Y
       
    42 Entrée : Les positions d'un point 2D
       
    43 Sortie : Met à jour X et Y*/
       
    44 void update(int x, int y)
       
    45 {
       
    46   X = x;
       
    47   Y = y;
       
    48 }