Processing Forum
import processing.core.PApplet;
public class Keyboard extends PApplet {
Main p;
public Keyboard(Main p) {
this.p = p;
}
public void run() {
keyPressed();
}
public void keyPressed() {
// Enable PDF File Export
if (key == 's' || key == 'S') {
p.saveFlag = !p.saveFlag;
if (p.saveFlag) {
println("Saving ENABLED");
} else {
println("Saving Disabled");
}
}
// Print Timestamp
if (key == 't' || key == 'T') {
println(p.timestamp());
}
// Reset Sketch
if (key == 'r' || key == 'R') {
p.reset();
}
// Exit Sketch
if (key == 'q' || key == 'Q') {
exit();
}
// Increase Seed Value
if (key == CODED) {
if (keyCode == LEFT) {
p.seed--;
p.reset();
} else if (keyCode == RIGHT) {
p.seed++;
p.reset();
}
}
}
}