added webcam-mode and autoplay-mode
This commit is contained in:
23
source.pde
23
source.pde
@@ -38,10 +38,10 @@ class SourceManager { //no constructor
|
||||
void setImage(PImage img) { //set image to source
|
||||
imageChanged = true;
|
||||
source = img.get();
|
||||
fallbackImage = source;
|
||||
//fallbackImage = source;
|
||||
nativeResoX = source.width;
|
||||
nativeResoY = source.height;
|
||||
println(nativeResoX);
|
||||
//println(nativeResoX);
|
||||
}
|
||||
|
||||
void fallback() {
|
||||
@@ -49,7 +49,25 @@ class SourceManager { //no constructor
|
||||
setImage(fallbackImage); //fallbackImage should always be a copy of the last image that worked
|
||||
}
|
||||
|
||||
void startWebcam() {
|
||||
String[] cameras = Capture.list();
|
||||
println(cameras);
|
||||
cam.start();
|
||||
webcamMode = true;
|
||||
}
|
||||
void stopWebcam() {
|
||||
cam.stop();
|
||||
webcamMode = false;
|
||||
}
|
||||
|
||||
void update() {
|
||||
if (webcamMode) {
|
||||
if (cam.available()) {
|
||||
cam.read();
|
||||
setImage(cam);
|
||||
}
|
||||
}
|
||||
|
||||
if (source == null) {
|
||||
fallback();
|
||||
}
|
||||
@@ -105,6 +123,7 @@ class SourceManager { //no constructor
|
||||
if (isImage(path) || isVideo(path)) {
|
||||
println("Importing file " + path);
|
||||
if (moviePlaying) movie.stop();
|
||||
if (webcamMode) gui.webcam.setValue(false);
|
||||
if (isImage(path)) {
|
||||
moviePlaying = false;
|
||||
setImage(loadImage(path));
|
||||
|
||||
Reference in New Issue
Block a user