|
10
|
1 |
/*
|
|
8
|
2 |
* This file is part of the TraKERS\Front Processing package.
|
|
|
3 |
*
|
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/>
|
|
|
5 |
*
|
|
27
|
6 |
* For the full copyright and license information, please view the LICENSE
|
|
8
|
7 |
* file that was distributed with this source code.
|
|
|
8 |
*/
|
|
|
9 |
|
|
|
10 |
/*Exemple tiré de processing.org*/
|
|
|
11 |
|
|
|
12 |
import TUIO.*;
|
|
|
13 |
TuioProcessing tuioClient;
|
|
41
|
14 |
int port = 8080;
|
|
8
|
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 |
}
|