Guys, I am trying to run this code in Processing and it is not working. Nothing happens. Could someone help me?
import de.voidplus.leapmotion.*;
// ======================================================
// Table of Contents:
// ├─ 1. Swipe Gesture
// ├─ 2. Circle Gesture
// ├─ 3. Screen Tap Gesture
// └─ 4. Key Tap Gesture
// ======================================================
LeapMotion leap;
void setup(){
size(800, 500);
background(255);
// ...
leap = new LeapMotion(this).allowGestures(); // All gestures
// leap = new LeapMotion(this).allowGestures("circle, swipe, screen_tap, key_tap");
// leap = new LeapMotion(this).allowGestures("swipe"); // Leap detects only swipe gestures
}
void draw(){
background(255);
// ...
}
// ======================================================
// 1. Swipe Gesture
void leapOnSwipeGesture(SwipeGesture g, int state){
int id = g.getId();
Finger finger = g.getFinger();
PVector position = g.getPosition();
PVector positionStart = g.getStartPosition();
PVector direction = g.getDirection();
float speed = g.getSpeed();
long duration = g.getDuration();
float durationSeconds = g.getDurationInSeconds();
switch(state){
case 1: // Start
break;
case 2: // Update
break;
case 3: // Stop
println("SwipeGesture: " + id);
break;
}
}
// ======================================================
// 2. Circle Gesture
void leapOnCircleGesture(CircleGesture g, int state){
int id = g.getId();
Finger finger = g.getFinger();
PVector positionCenter = g.getCenter();
float radius = g.getRadius();
float progress = g.getProgress();
long duration = g.getDuration();
float durationSeconds = g.getDurationInSeconds();
int direction = g.getDirection();
switch(state){
case 1: // Start
break;
case 2: // Update
break;
case 3: // Stop
println("CircleGesture: " + id);
break;
}
switch(direction){
case 0: // Anticlockwise/Left gesture
break;
case 1: // Clockwise/Right gesture
break;
}
}
// ======================================================
// 3. Screen Tap Gesture
void leapOnScreenTapGesture(ScreenTapGesture g){
int id = g.getId();
Finger finger = g.getFinger();
PVector position = g.getPosition();
PVector direction = g.getDirection();
long duration = g.getDuration();
float durationSeconds = g.getDurationInSeconds();
println("ScreenTapGesture: " + id);
}
// ======================================================
// 4. Key Tap Gesture
void leapOnKeyTapGesture(KeyTapGesture g){
int id = g.getId();
Finger finger = g.getFinger();
PVector position = g.getPosition();
PVector direction = g.getDirection();
long duration = g.getDuration();
float durationSeconds = g.getDurationInSeconds();
println("KeyTapGesture: " + id);
}