/* ########################################## my own tree by jennifer hughes miriam farschon mikko max reim for echtzeitanwendungen virtual design fh kaiserslautern in processing 0135beta ########################################## */ import processing.xml.*; import java.awt.*; import java.lang.Thread; String activeuser; PFont font, sfont, smallfont; PImage hgbild, fgbild, B_stamm, B_mastl, B_mastr, B_ast, hgbild_cut; XMLElement xmlcharts; boolean CalcLock = false; boolean ChartsLoaded = false; String Curstatus = ""; //anfang baum float theta, bend, bendr; float a, b; int ziel; String iLine; float minusneunzig = radians(-90); float plusneunzig = radians(90); String [] array1 = new String[0]; String [] array1b = new String[0]; String [] array2 = new String[0]; String [] array2b = new String[0]; String [] array3 = new String[0]; String [] array3b = new String[0]; String [] array4 = new String[0]; String [] array4b = new String[0]; String [] array5 = new String[0]; String [] array5b = new String[0]; String [] array6 = new String[0]; String [] array6b = new String[0]; String array1tag = ""; String array2tag = ""; String array3tag = ""; String array4tag = ""; String array5tag = ""; boolean doOnce = true; boolean FdoOnce = true; boolean TdoOnce = true; //ende baum //grashalme: CL_grashalm [] grashalme = new CL_grashalm[500]; //feld: String [] friendsarray = new String[0]; float [] TOMarray = new float[0]; CL_bluemchen [] bluemchen; CL_friendsloader floader; CL_tomloader tomloader; boolean bluemchenactive = false; //time CL_albumchartsloader albmloader; boolean albumcalcdone = false; CL_albumcharts [] topalbumsarray; int high = 0; int low = 0; int navoffset = 0; int navpos = 0; //bienchen CL_bienchen [] bienchen = new CL_bienchen[0]; boolean bienchenlock = false; int bienchencounter = 0; //chartsarray 50 toptags int artistnum = 50; CL_charts[] personalcharts = new CL_charts[artistnum]; //CL_textFeld textfeld; CL_status statusfeld; //Thread artisttagloaderThread = new CL_artisttagloader(); CL_artisttagloader loader; TextField textField = new TextField("please enter your last.fm username", 30); Button TFbutton, treeOverall, tree12months, tree3months, tree, time, field; String navi = ""; boolean tf_set = false; void setup(){ size(800,600); add(textField); //pfeil = loadImage("pfeil.png"); hgbild = loadImage("bg.png"); //hgbild_cut = loadImage("bg_cut.png"); fgbild = loadImage("fg.png"); B_stamm = loadImage("_stamm.png"); B_mastl = loadImage("_masterast_l.png"); B_mastr = loadImage("_masterast_r.png"); B_ast = loadImage("_ast.png"); //loader = new CL_artisttagloader(this); font = loadFont("Verdana-15.vlw"); sfont = loadFont("Georgia-15.vlw"); statusfeld = new CL_status(); statusfeld.active = true; //textfeld = new CL_textFeld(); //textfeld.active = true; frameRate(20); noStroke(); loop(); background(hgbild); //buttons erstellen und position setzen!: TFbutton = new Button(width/2+130, 25, 15, color(0), color(255), color(255), "{ submit }"); TFbutton.active = true; tree = new Button(10, 470, 15, color(0), color(255), color(255), "{ tree }"); tree.active = false; textFont(sfont); float abstandhalter = textWidth("{ tree }")+10+10; field = new Button(abstandhalter, 470, 15, color(0), color(255), color(255), "{ field }"); field.active = false; abstandhalter = textWidth("{ tree }")+10+10+textWidth("{ field }")+10; time = new Button(abstandhalter, 470, 15, color(0), color(255), color(255), "{ time }"); time.active = false; treeOverall = new Button(10, 493, 15, color(108), color(255), color(255), "{ overall }"); treeOverall.active = false; abstandhalter = textWidth("{ overall }")+10+10; tree12months = new Button(abstandhalter, 493, 15, color(108), color(255), color(255), "{ 12 months }"); tree12months.active = false; abstandhalter = textWidth("{ overall }")+10+10+textWidth("{ 12 months }")+10; tree3months = new Button(abstandhalter, 493, 15, color(108), color(255), color(255), "{ 3 months }"); tree3months.active = false; //baum a=0; b=0; ziel=10; bend = 0; bendr = 0; //grashalme: for(int i= 0; i<500;i++){ noiseSeed(i); float pos = noise(width)*width; float laenge = random(6,15); grashalme[i] = new CL_grashalm(pos, 450, laenge, 3, true, i); } //time albmloader = new CL_albumchartsloader(this); } void draw(){ smooth(); fill(0); //image(hgbild_cut, 0, 150); background(hgbild); noStroke(); statusfeld.draw(); TFbutton.update(); TFbutton.display(); tree.update(); tree.display(); field.update(); field.display(); time.update(); time.display(); treeOverall.update(); treeOverall.display(); tree12months.update(); tree12months.display(); tree3months.update(); tree3months.display(); image(fgbild, 0, 0); bienchencounter++; if (bienchencounter > 200){ bienchencounter = 0; float randomX = random(100,550); triggerbees(randomX,450); } for (int i=0;i-300){ navoffset -= 100; } } else if (keyCode == LEFT){ if (50-navoffset+navpos <= 50){ navpos += 50; } } else if (keyCode == RIGHT){ if(750+navoffset+navpos >= 550){ navpos -= 50; } } } buildalbumtree(); } } void mouseReleased(){ TFbutton.release(); tree.release(); field.release(); time.release(); treeOverall.release(); tree12months.release(); tree3months.release(); } void mousePressed(){ if (CalcLock != true){ if (TFbutton.press() == true) { iLine = textField.getText(); //println("bla"+iLine); if (iLine.length() > 0){ checkuser(iLine); } } if (tree.press() == true){ bluemchenactive = false; if(treeOverall.active == false){ treeOverall.active = true; tree12months.active = true; tree3months.active = true; } } if (treeOverall.press()){ navi = "tree"; bluemchenactive = false; chartsloader(activeuser,"overall"); } if (tree12months.press()){ navi = "tree"; bluemchenactive = false; chartsloader(activeuser,"12months"); } if (tree3months.press()){ navi = "tree"; bluemchenactive = false; chartsloader(activeuser,"3months"); } if (field.press()){ if (navi.equals("field")){ } else{ CalcLock = true; navi = "field"; treeOverall.active = false; tree12months.active = false; tree3months.active = false; if (FdoOnce == false){ //doOnce == true floader.stop(); tomloader.stop(); } FdoOnce = false; //feld: floader = new CL_friendsloader(this); floader.start(); } } if (time.press()){ if (navi.equals("time")){ } else{ CalcLock = true; navi = "time"; bluemchenactive = false; treeOverall.active = false; tree12months.active = false; tree3months.active = false; if (TdoOnce == false){ //doOnce == true albmloader.stop(); } TdoOnce = false; //feld: albmloader = new CL_albumchartsloader(this); albumcalcdone = false; high = 0; low = 0; navoffset = 0; navpos = 0; albmloader.start(); } } } } void doTOMstart(){ tomloader = new CL_tomloader(this); tomloader.start(); }