Just started working with processing, made 2 different .pde's but I'd like them to work them as 1 .pde.
Theres the main menu
Code:
import gifAnimation.*;
import ddf.minim.*;
Minim minim;
AudioSnippet songR;
AudioSnippet songL;
int albumSize = 3;
int selectedPhoto = 0;
PImage[] photoAlbum;
int timer;
Gif loopingGif;
void setup() {
photoAlbum = new PImage[albumSize];
size(1024, 768);
photoAlbum[0] = loadImage("1.png");
photoAlbum[1] = loadImage("2.png");
photoAlbum[2] = loadImage("3.png");
frameRate(7);
loopingGif = new Gif(this, "splash.gif");
loopingGif.loop();
timer = 0;
imageMode(CENTER);
minim = new Minim(this);
songR = minim.loadSnippet("rechts.wav");
songL = minim.loadSnippet("links.wav");
}
void draw() {
timer++;
image(loopingGif, width/2, height/2);
if(timer>=40){
if (photoAlbum[selectedPhoto] != null) {
image(photoAlbum[selectedPhoto], width/2, height/2);
}
}
}
void keyReleased() {
if(key ==',') {
songR.play();
songR.rewind();
if(selectedPhoto < 1) {
selectedPhoto = photoAlbum.length - 1;
} else {
selectedPhoto--;
}
}
if (key == '.') {
songL.play();
songL.rewind();
if(selectedPhoto > photoAlbum.length - 2){
selectedPhoto = 0;
} else {
selectedPhoto++;
}
}
println(selectedPhoto);
}
and when you choose the 1st menu (got 3 menu's) by pressing both the keys , and . i want to get this other menu I made.
Code:int albumsize = 30;
int selected = 0;
PImage[] photo;
void setup() {
photo = new PImage[albumsize];
size (1024, 768);
photo[0] = loadImage("1.jpg");
photo[1] = loadImage("2.jpg");
photo[2] = loadImage("3.jpg");
photo[3] = loadImage("4.jpg");
photo[4] = loadImage("5.jpg");
photo[5] = loadImage("6.jpg");
photo[6] = loadImage("7.jpg");
photo[7] = loadImage("8.jpg");
photo[8] = loadImage("9.jpg");
photo[9] = loadImage("10.jpg");
photo[10] = loadImage("11.jpg");
photo[11] = loadImage("12.jpg");
photo[12] = loadImage("13.jpg");
photo[13] = loadImage("14.jpg");
photo[14] = loadImage("15.jpg");
photo[15] = loadImage("16.jpg");
photo[16] = loadImage("17.jpg");
photo[17] = loadImage("18.jpg");
photo[18] = loadImage("19.jpg");
photo[19] = loadImage("20.jpg");
photo[20] = loadImage("21.jpg");
photo[21] = loadImage("22.jpg");
photo[22] = loadImage("23.jpg");
photo[23] = loadImage("24.jpg");
photo[24] = loadImage("25.jpg");
photo[25] = loadImage("26.jpg");
photo[26] = loadImage("27.jpg");
photo[27] = loadImage("28.jpg");
photo[28] = loadImage("29.jpg");
photo[29] = loadImage("30.jpg");
}
void draw() {
background(0);
if (photo[selected] != null) {
image(photo[selected], 0, 0);
}
}
void keyReleased() {
if (key ==',') {
if(selected < 1) {
selected = photo.length - 1;
}
else {
selected--;
}
}
if (key =='.') {
if(selected > photo.length - 2) {
selected = 0;
} else {
selected++;
}
}
}
It doesnt have to be 1 pde, as long as they work together when you run it. can some1 help me?
Thanks in advance.