im just starting out in processing ( making a data visualization) and having some trouble with the if mousepressed function with text and having it display an image. Basically, i want the user to be able to click on a piece of text and have a certain image appear. Any help with what I am doing wrong would be great... heres my code
PImage blue;
PImage red;
PImage green;
PImage orange;
PImage yellow;
PImage original;
void setup() {
size(800,800);
// f = loadFont("Calibri-48.vlw");
// Make a new instance of a PImage by loading an image file
blue = loadImage("bluemap.gif");
image(blue,0,0);
blue.resize(800,0);
image(blue,0,0);
red = loadImage("redmap.gif");
image(red,0,0);
red.resize(800,0);
image(red,0,0);
green = loadImage("greenmap.gif");
image(green,0,0);
green.resize(800,0);
image(green,0,0);
orange = loadImage("orangemap.gif");
image(orange,0,0);
orange.resize(800,0);
image(orange,0,0);
yellow = loadImage("yellowmap.gif");
image(yellow,0,0);
yellow.resize(800,0);
image(yellow,0,0);
original = loadImage("originalmap.png");
image(original,0,0);
original.resize(800,0);
image(original,0,0);
}
void draw() {
background(0);
// Draw the image to the screen at coordinate (0,0)
image(original,0,0);
// legend
textSize(15);
// textFont(f,48);
textAlign(CENTER); // position of the text at the center