Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
matthew.neumayer
matthew.neumayer's Profile
2
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
value returning keypressed() not working
[1 Reply]
28-Feb-2013 10:16 PM
Forum:
Programming Questions
I'm tiring to retrieve a Boolean value after the space bar is pushed.I believe i'm doing it right but when I try to run it outputs "unexpected token : boolean"
/**
* PhotoBoothV2.pde
*/
import processing.video.*;
boolean sketchFullScreen() {
return true;
}
// resolution: 800x600 - change it if you want
//Crap
//int cols = 320;
//int rows = 240 ;
//720p
//int cols = 1280;
//int rows = 720 ;
//1080p
int cols = 1920;
int rows =1080;
Capture cam;
int mainwidth = cols;
int mainheight = rows;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
int time5 = 70;
int time4 = 60;
int time3 = 50;
int time2 = 40;
int time1 = 30;
int x = 1;
boolean countDown ;
PFont font;
String number;
long starttime;
long time;
//PImage img2;
void setup() {
size(1600, 900);
frameRate(30);
//size(mainwidth, mainheight, JAVA2D);
//size(1600,900);
colorMode(RGB);
cam = new Capture(this, cols, rows);
cam.start();
noSmooth();
background(51);
font = loadFont("AgencyFB-Bold-200.vlw");
textFont(font);
number = " ";
countDown = false;
}
void draw() {
if (cam.available()) {
cam.read();
image(cam, 0, 0, 320, 240);
fill(RGB);
fill(255, 0, 0);
text(number, 100, 100);
if (countDown == true)
{
while ( (time - starttime) >= 5000)
{
image(cam, 0, 0, 320, 240);
time = millis();
if ((time -starttime) >= 1000)
{
number = "5";
}
if ((time -starttime) >= 2000)
{
number ="4";
}
if ((time -starttime) >= 3000)
{
number= "3";
}
if ((time -starttime) >= 4000)
{
number = "2";
}
if ((time -starttime) >= 5000)
{
number = "1";
}
countDown = false;
}
}
save("temp/temp1.jpg");
cam.save("temp/temp1.jpg");
}
boolean keyPressed() {
if (key == ' ') { // space bar
textSize(200);
starttime = millis();
countDown = true ;
return countDown;
}
// img1 =img.get();
// img1.save("picture-####.jpg");
// PImage img2 = createImage(320,240,RGB);
//img2.loadPixels();
//cam.stop();
//saveFrame("picture-####.jpg");
if (key == 'l') {
//cam.stop();
img1 = loadImage("temp/temp1.jpg");
image(img1, 0, 0 );
//image(img1, 0, 0);
//image(img2, 0, 0);
}
if (key == 'q') {
exit();
}
}
Count down Timer not working?
[2 Replies]
26-Feb-2013 07:30 PM
Forum:
Programming Questions
Here is my code . Can some one please help? I don't know why my while loop will not execute properly?
/**
* PhotoBoothV2.pde
*/
import processing.video.*;
boolean sketchFullScreen() {
return true;}
// resolution: 800x600 - change it if you want
//Crap
//int cols = 320;
//int rows = 240 ;
//720p
//int cols = 1280;
//int rows = 720 ;
//1080p
int cols = 1920;
int rows =1080;
Capture cam;
int mainwidth = cols;
int mainheight = rows;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
int time5 = 20;
int time4 = 30;
int time3 = 40;
int time2 = 50;
int time1 = 60;
int x ;
PFont font;
String number;
long starttime;
long time;
//PImage img2;
void setup() {
size(1600,900);
frameRate(30);
//size(mainwidth, mainheight, JAVA2D);
//size(1600,900);
colorMode(RGB);
cam = new Capture(this, cols, rows);
cam.start();
noSmooth();
background(51);
font = loadFont("AgencyFB-Bold-200.vlw");
textFont(font);
number = " ";
}
void draw() {
if (cam.available()) {
cam.read();
image(cam, 0, 0,320,240);
fill(RGB);
fill(255,0,0);
text(number,100,100);
}
}
void keyPressed() {
if (key == ' ') { // space bar
textSize(200);
starttime = millis();
x = 0;
while (x < 5)
{
time = millis();
print(starttime - time);
if((starttime - time) == time5)
{
number = "5";
}
else if ((starttime - time) == time4)
{
number = "4";
println(starttime-time);
}
else if ((starttime - time) == time3)
{
number= "3";
}
else if ((starttime - time) == time2)
{
number = "2";
}
else if((starttime - time) == time1)
{
number = "1";
}
x++;
}
save("temp/temp1.jpg");
cam.save("temp/temp1.jpg");
// img1 =img.get();
// img1.save("picture-####.jpg");
// PImage img2 = createImage(320,240,RGB);
//img2.loadPixels();
//cam.stop();
//saveFrame("picture-####.jpg");
}
if (key == 'l') {
//cam.stop();
img1 = loadImage("temp/temp1.jpg");
image(img1, 0,0 );
//image(img1, 0, 0);
//image(img2, 0, 0);
}
if (key == 'q'){
exit();
}
}
«Prev
Next »
Moderate user : matthew.neumayer
Forum