-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlistener.java
63 lines (47 loc) · 1.7 KB
/
listener.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package leap;
import com.leapmotion.leap.Controller;
import com.leapmotion.leap.Frame;
import com.leapmotion.leap.Hand;
import com.leapmotion.leap.HandList;
import com.leapmotion.leap.InteractionBox;
import com.leapmotion.leap.Listener;
import com.leapmotion.leap.Pointable;
/**
*
* @author thomas
*/
public class listener extends Listener {
Connect conn= new Connect();
public void onFrame(Controller controller){
Frame frame = controller.frame();
Hand firsthand = frame.hands().rightmost();
if(firsthand.confidence()>.15){
com.leapmotion.leap.Vector velo = firsthand.palmVelocity();
conn.insert(String.valueOf(velo.get(0)), String.valueOf(velo.get(2)));
conn.selectAll();
System.out.println("x"+velo.get(0));
System.out.println("y"+velo.get(1));
System.out.println("z"+velo.get(2));
}
}
public void onInit (Controller controller){
System.out.println("Initialized");
}
public void onConnect (Controller controller){
System.out.println("Connected");
}
public void onDisconnect (Controller controller){
System.out.println("Disconnected");
}
public void onFocusGained (Controller controller){
System.out.println("Focus gained");
}
public void onFocusLost (Controller controller){
System.out.println("Focus lost");
}
}