Program WAITS UNTIL something happens compared to last time it ran, then it starts again?
in
Programming Questions
•
10 months ago
- I have a program that grabs images from a server that other people submit to.
- It grabs an image from the server & displays that image, then sequentially displays a random image from the web.
- It goes
A1,
B1,
A2,
B2,
A3,
B3, ... "
A" being
SUBMITTED images, and "
B" being
random images fetched from google.
The PROBLEM is that if only one "
A" image is submitted, (
cat.jpg), the program will display "
cat.jpg", then "
random1.jpg".
When the program is finished, it starts again, skips past "
cat.jpg" as it knows not to display duplicates, and then displays "
random2.jpg". It will then just keep on starting over and over again, skipping "
cat.jpg" (which it is supposed to do) and displaying random google images, so it ends up being more like
A1,
B1, B2, B3, B4, etc.
How can I tell the program ONCE IT REACHES THE END, TO STILL RUN, BUT WAIT UNTIL it gets a new
A image, and then continue to display a
B.
there is allot of code so I guess I will save anyone the headache of reading through it all, but a pseudo mock up of what i want to happen I think would look like this? :
void draw() {
- add images from server into an array
- display an image if its not already in the array (avoiding duplicates)
if there are any new images in that array compared to last time{
- search google for an image
- display the image from google
}
else just wait until there is a new image
}
..
The part I want to add is in purple...
1