-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.pde
92 lines (76 loc) · 2.03 KB
/
events.pde
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***********************/
/* LithoKeyRingCreator */
/***********************/
/* Basé sur le logiciel image2stl de Joel Belouet */
/* Version spécifique pour CKAB */
/* Joel Belouet http://joel.belouet.free.fr/ */
/* Cyril Chapellier http://tchap.me */
/* Zooming with the wheel */
void mouseWheel(MouseEvent event) {
println(event.getCount());
zoom = min(max(5.0,zoom - float(event.getCount())/5.0),20.0);
println("zoom " + zoom);
//checkPixels();
//s3.setValue(zoom);
// println("INFO : Setting Zoom to : " + meshSize);
}
/* Rotating (left-click) */
void mouseDragged() {
if ( mouseX > 200 ) {
if ( pmouseX < mouseX ) {
rotYT += mouseX - pmouseX;
} else {
rotYT -= pmouseX - mouseX;
}
if ( pmouseY < mouseY ) {
rotXT -= mouseY - pmouseY;
} else {
rotXT += pmouseY - mouseY;
}
}
}
/* KeyBoar Controls : UP/DOWN/LEFT/RIGHT keys to rotate the shape */
/* SPACEBAR to generate the .stl */
void keyPressed() {
switch(keyCode) {
case LEFT:
rotYT -= 15 ;
break;
case RIGHT:
rotYT += 15 ;
break;
case UP:
rotXT += 15 ;
break;
case DOWN:
rotXT -= 15 ;
break;
case BACKSPACE: // You can use BackSpace to generate the .stl
record = true;
break;
default:
break;
}
}
/* When clicking on "choose" */
void controlEvent(ControlEvent theEvent) {
if (theEvent.getController().getName() == "Choisir") {
selectInput("Choisir une image (jpg, jpeg ou png) : ", "fileSelected");
} else if (theEvent.getController().getName() == "Exporter") {
choooseExportFile = true;
messageExport = true;
} else if (theEvent.getController().getName() == "Webcam") {
message("Initializing video");
capture = true;
} else if (theEvent.getController().getName() == "Capturer") {
capture_do = true;
}
}
void fileSelected(File selection) {
if (selection != null) {
capturedImg = null;
filename = selection.getAbsolutePath();
println("User selected " + filename);
load_image();
}
}