configure UI and more leapmotion examples
This commit is contained in:
parent
9b0c8ffc86
commit
ebe188592e
4 changed files with 392 additions and 1 deletions
|
|
@ -0,0 +1,40 @@
|
|||
import redis.clients.jedis.Jedis;
|
||||
import java.util.ArrayList;
|
||||
|
||||
ArrayList<PVector> points = new ArrayList<PVector>();
|
||||
|
||||
int rgb2int(int[] rgb) {
|
||||
return color(rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
void setup() {
|
||||
size(640, 360);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(51);
|
||||
stroke(255);
|
||||
strokeWeight(2); // adjust the thickness of the circle outline
|
||||
if (mousePressed) {
|
||||
PVector p = new PVector(mouseX, mouseY);
|
||||
points.add(p);
|
||||
noFill(); // disable filling
|
||||
ellipse(p.x, p.y, 10, 10); // draw a circle with lines at the point
|
||||
}
|
||||
|
||||
if (points.size() > 0) {
|
||||
String pointList = "[";
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
PVector p = points.get(i);
|
||||
int[] rgb = {255, 255, 255};
|
||||
pointList += "(" + p.x + "," + p.y + "," + rgb2int(rgb) + "),";
|
||||
}
|
||||
pointList = pointList.substring(0, pointList.length() - 1); // remove the last comma
|
||||
pointList += "]";
|
||||
System.out.println(pointList);
|
||||
|
||||
Jedis jedis = new Jedis("localhost");
|
||||
jedis.set("/pl/0/0", pointList);
|
||||
jedis.close();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue