front_processing/src/Interaction_examples/Hand_press/Hand_press.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 float minDistHands = 1, maxDistHands = 1.5;
       
    18 //Distance de "click" minimum/maximum avec la main.
       
    19 float minClickHand = minDistHands+0.2, maxClickHand = maxDistHands-0.2;
       
    20 
       
    21 void setup() {
       
    22   size(WIDTH, HEIGHT);
       
    23   tuioClient = new TuioProcessing(this, port);
       
    24   fill(126);
       
    25   background(102);
       
    26 }
       
    27 
       
    28 void draw() {
       
    29   tuioInput();
       
    30 }
       
    31 
       
    32 void crux(TuioPoint pt)
       
    33 {
       
    34   if(pt.getZ() > minClickHand && pt.getZ() < maxClickHand) {
       
    35     stroke(255);
       
    36   } else {
       
    37     stroke(0);
       
    38   }
       
    39   line(pt.getX()-66, pt.getY(), pt.getX()+66, pt.getY());
       
    40   line(pt.getX(), pt.getY()-66, pt.getX(), pt.getY()+66); 
       
    41 }