class GUI{ float x,y; float margin; float bw; float gutter; float pw; float ph; boolean showSet; boolean showInput; int ug; int ua; int dotSelect; //button Button2 start; Button2 saveB, cancelB, refreshB; Choise gender, age; //String array for the introduction String intro[]; Dot[] spot; GUI(){ } GUI(float x_, float y_){ x = x_; y = y_; margin = 20; gutter =10; pw = (sw)/3; ph = sh-y; bw = ((pw-40)-20)/3; float sww = sw/3-(3*margin+(bw)*2); float bhh = y+ph-margin-60; showSet = true; showInput = false; spot = new Dot[3]; String star="START"; start = new Button2( star, x+margin+2*bw+gutter*2, y+60, sww, 15,0,1,1, helv11); //saveButton = new Button(t, sw/3, 580, 60, 30, 5, 1, 1, hel11); String can="CANCEL"; cancelB = new Button2(can, x+margin, bhh, bw, 15, 0, 1, 1, helv11); String ref="REFRESH"; refreshB = new Button2(ref, x+margin+bw+gutter, bhh, bw, 15, 0, 1, 1, helv11); String sav="SAVE"; saveB = new Button2(sav, x+margin+2*bw+2*gutter, bhh,bw, 15, 0, 1, 1, helv11); String g[] ={"Gender", "Male", "Female"}; gender = new Choise(g, x+margin, y+60, bw-20, helv11); String a[] ={"Age Group", "0-10","11-20", "21-30","31-40","41-50","51-60","61-70","Over 70s" }; age = new Choise(a, x+margin+bw+gutter, y+60, bw-20, helv11); intro = loadStrings("exp.txt"); color visC = color(60,125,23); String vt = "Visual Sensations"; spot[0] = new Dot(sw/3+margin, 100, 15 ,15, visC, vt, spot, 0); color audioC = color(49,108,222); String at = "Audio Sensations"; spot[1] = new Dot(sw/3+margin+spot[0].tlength+gutter*2, 100, 15 ,15, audioC, at, spot, 1); color spaceC = color(206,88,33); String st = "Spatial Sensations"; spot[2] = new Dot(sw/3+margin+spot[0].tlength+spot[1].tlength+4*gutter, 100, 15 ,15, spaceC, st, spot, 2); } void display(){ color st = color(100,100,99,60); if(ug == 1){ svg_display(stm, sw/3, 10, 200, 471,0.8,st); }else if(ug == 0){ color sst = color(100,100,99,20); svg_display(stm, sw/3, 10, 200, 471,0.8,sst); }else{ svg_display(stw, sw/3+15, 10, 187, 467,0.8,st); } introduction(); inputSet(); dotSelection(); } void dotSelection(){ for(int i=0; i<3 ; i++){ if(spot[i].sp.isPressed){ dotSelect = i; spot[dotSelect].selected = true; }else if(i != dotSelect){ spot[i].selected = false; } } } void introduction(){ if(showSet == true ){ start.display(); //display introduction text fill(255,118,5); textFont(helv12); text(intro[0], sw/3+margin, 40, sw/3-2*margin, 150); fill(220); textFont(helv11); text(intro[1], sw/3+margin, 90, sw/3-2*margin, 150); gender.display(); age.display(); ug = gender.selectId; ua = age.selectId; //println("ug "+ ug); if(start.isPressed && ug !=0 && ua !=0){ showInput = true; showSet = false; }else if(start.isOver && (ug ==0 || ua ==0)){ fill(10,220); rect(sw/3, 0, sw/3, 150); textFont(helv12); fill(220,220); text("Please select your gender and age.", sw/3+margin+50, 80, sw/3-2*margin, 150); } fill(80); textFont(ari9); text(intro[4], sw/3+margin, sh-80, sw/3-margin, 150); } } void inputSet(){ if(showInput == true ){ noFill(); stroke(25); rect(sw/3+margin, 170, sw/3-2*margin, 440); noStroke(); saveB.display(); cancelB.display(); refreshB.display(); fill(255,118,5); textFont(helv11); text(intro[3], sw/3+margin, 40, sw/3-2*margin, 150); //dot mark display for(int i=0; i<3; i++){ spot[i].display(); if(spot[i].selected){ textFont(helv10); fill(255,150); noStroke(); text("Add spots : Click Left mouse Button ", sw/3+margin, 145, sw/3-2*margin, 150); text("Delete spots : Click Right mouse Button on the spot", sw/3+margin, 155, sw/3-2*margin, 150); } } if(saveB.isPressed || cancelB.isPressed){ showInput = false; showSet = true; } } } }