Processing for Android

EN ES

Touches array

This array contains the list of current touch pointers. Each pointer is characterized by its x,y coordinate, area, pressure, and a unique ID.


void setup() {
  fullScreen();
  textFont(createFont("SansSerif", 24 * displayDensity));
  textAlign(CENTER, CENTER);
}    

void draw() {
  background(255);
  for (int i = 0; i < touches.length; i++) {
    float d = (100 + 100 * touches[i].area) * displayDensity;
    fill(0, 255 * touches[i].pressure);
    ellipse(touches[i].x, touches[i].y, d, d);
    fill(255, 0, 0);
    text(touches[i].id, touches[i].x + d/2, touches[i].y - d/2);
  } 
}