hello,
hm....
you have
- if (key==1){
and
- if (key=='7'){
I would recommend to have it all in keyPressed() -
better use keyReleased instead of keyPressed()
Since you want to have two images you need
- image1 and
- image2
ok, let me see....
we can use count to determine how many pictures have been shot.....
and how the program must behave with each step:
- 0 images: count = 0: wait for 1st image (taken when user presses "1")
- 1 images: count = 1: show 1st image on the left and wait for 2nd image (taken when user presses "1" again)
- 2 images: count = 2: show 1st image on the left and show 2nd image on the right (when user presses "1" again, you might want to delete both images and reset count to 0)
so draw() looks like this:
- void draw() {
- switch (count) {
- case 0:
- // do nothing
- break;
- case 1:
- image (image1, 100, 100);
- break;
- case 2:
- image (image1, 100, 100);
- image (image2, 400, 100);
- break;
- } // switch
- } // func
have a similar switch also in keyReleased():
- void keyReleased () {
- if (key == '1') {
- switch (count) {
- case 0:
- // get image1 from cam - I dunno how
- // image1=cam;
- count = 1;
- break;
- case 1:
- // get image2 from cam - I dunno how
- // image2=cam;
- count=2;
- break;
- case 2:
- // reset
- image1=null;
- image2=null;
- count = 0;
- break;
- } // switch
- } // if
- } // func
Greetings, Chrisir