class ReligionButton{ int id; float x, y, w, h, a; boolean hover; boolean clicked = true; private float iconSize = window_w/30; ReligionButton(int tempid){ id = tempid; x = 64/scaleAmount; y = 704/scaleAmount+((100/scaleAmount)*id); w = 75/scaleAmount; h = 75/scaleAmount; } void update(){ if (mouseX >= x-iconSize/2 && mouseX <= x+iconSize/2 && mouseY >= y-iconSize/2 && mouseY <= y+iconSize/2){ hover = true; } else { hover = false; } if(hover){ a = 255; iconSize = window_w/20; } else { a = 220; iconSize = window_w/25; } } void display(){ tint(255,a); // if (hover){ // image(icons[44],x,y,w*1.5,h*1.5); // } if (clicked){ for(int i = 0; i < ipoint_c; i++){ if(infopoints[i].religion == id){ infopoints[i].active = true; ellipseMode(CENTER); fill(infopoints[i].religionColor); // stroke(100); noStroke(); ellipse(map(infopoints[i].yearBegin,yearMin,yearMax,timeline.xpos,timeline.xpos+timeline.swidth), 1360.8/scaleAmount+infopoints[i].religion*(13/scaleAmount) ,5/scaleAmount,5/scaleAmount); } } if(id == 0){ fill(#FDD686); } else if(id == 1){ fill(#DE719E); } else if(id == 2){ fill(#57BD91); } else if(id == 3){ fill(#6A9FDE); } ellipse(x,y,w,h); } else { for(int i = 0; i < ipoint_c; i++){ if(infopoints[i].religion == id){ infopoints[i].active = false; } } } noFill(); stroke(#FFFFFF); strokeWeight(1/scaleAmount); ellipse(x,y,w,h); fill(#FFFFFF); if(id == 0){ shape(christian,x,y,christian.width/scaleAmount,christian.height/scaleAmount); } else if(id == 1){ shape(buddhism,x,y,buddhism.width/scaleAmount,buddhism.height/scaleAmount); } else if(id == 2){ shape(islam,x,y,islam.width/scaleAmount,islam.height/scaleAmount); } else if(id == 3){ shape(jew,x,y,jew.width/scaleAmount,jew.height/scaleAmount); } } }