A versatile interface for the info-sphere in form of a world map with timeline with changing borders, created to be used in other projects
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

gui.pde 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. class ReligionButton{
  2. int id;
  3. float x, y, w, h, a;
  4. boolean hover;
  5. boolean clicked = true;
  6. private float iconSize = window_w/30;
  7. ReligionButton(int tempid){
  8. id = tempid;
  9. x = 64/scaleAmount;
  10. y = 704/scaleAmount+((100/scaleAmount)*id);
  11. w = 75/scaleAmount;
  12. h = 75/scaleAmount;
  13. }
  14. void update(){
  15. if (mouseX >= x-iconSize/2 && mouseX <= x+iconSize/2
  16. && mouseY >= y-iconSize/2 && mouseY <= y+iconSize/2){
  17. hover = true;
  18. } else {
  19. hover = false;
  20. }
  21. if(hover){
  22. a = 255;
  23. iconSize = window_w/20;
  24. } else {
  25. a = 220;
  26. iconSize = window_w/25;
  27. }
  28. }
  29. void display(){
  30. tint(255,a);
  31. // if (hover){
  32. // image(icons[44],x,y,w*1.5,h*1.5);
  33. // }
  34. if (clicked){
  35. for(int i = 0; i < ipoint_c; i++){
  36. if(infopoints[i].religion == id){
  37. infopoints[i].active = true;
  38. ellipseMode(CENTER);
  39. fill(infopoints[i].religionColor);
  40. // stroke(100);
  41. noStroke();
  42. 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);
  43. }
  44. }
  45. if(id == 0){
  46. fill(#FDD686);
  47. } else if(id == 1){
  48. fill(#DE719E);
  49. } else if(id == 2){
  50. fill(#57BD91);
  51. } else if(id == 3){
  52. fill(#6A9FDE);
  53. }
  54. ellipse(x,y,w,h);
  55. } else {
  56. for(int i = 0; i < ipoint_c; i++){
  57. if(infopoints[i].religion == id){
  58. infopoints[i].active = false;
  59. }
  60. }
  61. }
  62. noFill();
  63. stroke(#FFFFFF);
  64. strokeWeight(1/scaleAmount);
  65. ellipse(x,y,w,h);
  66. fill(#FFFFFF);
  67. if(id == 0){
  68. shape(christian,x,y,christian.width/scaleAmount,christian.height/scaleAmount);
  69. } else if(id == 1){
  70. shape(buddhism,x,y,buddhism.width/scaleAmount,buddhism.height/scaleAmount);
  71. } else if(id == 2){
  72. shape(islam,x,y,islam.width/scaleAmount,islam.height/scaleAmount);
  73. } else if(id == 3){
  74. shape(jew,x,y,jew.width/scaleAmount,jew.height/scaleAmount);
  75. }
  76. }
  77. }