// EBra Entrenador Braile 0.8 // © Jordi González 2009/CRAER Landete // // Este programa se distribuye sin ninguna garantía bajo los términos de la // Licencia Pública General de la Free Software Foundation // EBra és software lliure; pot redistribuirlo i/o modificar-lo baix els termes // de la Llicencia Pública General GNU tal i com es publica per la Free Software // Foundation; ja siga la versió 2 de la llicencia o (a la seua elecció) qualsevol // versió poserior. // Aquest programa es distribueix amb l'esperànça de que li sigua útil, però SENSE // CAP GARANTIA; sense, fins i tot, la garantia implícita de MERCANTILITAT O IDONEITAT // PER A UN PROPÒSIT PARTICULAR. Veja la Llicència Pública General GNU per a més // detalls (pot trobar-la en http://www.gnu.org/licenses/ ). int[] posx = new int[6]; int[] posy = new int[6]; boolean[] pintat = new boolean[6]; boolean mostrar = false; int diam = 180; PFont fontA; int tx = 600; int ty = 500; void setup() { size (750,600); posx[0]= 130; posy[0]=115; posx[1]= 130; posy[1]=308; posx[2]= 130; posy[2]=500; posx[3]= 340; posy[3]=115; posx[4]= 340; posy[4]=308; posx[5]= 340; posy[5]=500; fontA = loadFont("Verdana-36.vlw"); textAlign(CENTER); smooth(); } void draw () { background (0); stroke (255); for (int i=0;i<6;i++) { if (pintat[i]) {fill (255,0,0);} else { fill(0);} ellipse (posx[i],posy[i],diam,diam); } fill(0,255,0); textFont(fontA, 30); text("Entrenador Braille", 560,22); text("CRAER de Landete", 560, 42); if (mostrar) {mostra();} } void mousePressed () { for (int i = 0; i<6;i++) { if(sqrt(sq(mouseX-posx[i]) + sq(mouseY-posy[i])) < diam/2 ) { pintat[i] = !pintat[i]; } } } void keyPressed () { if (key == ' ') { mostrar=!mostrar; } } void mostra () { textFont(fontA, 100); String codi=""; int codii; for (int i=0;i<6;i++) { if (pintat[i]) {codi=codi + "1";} else {codi=codi+"0";} } codii=int(codi); println(codii); switch(codii) { case 100000: println("a"); text("a", tx,ty); break; case 110000: text("b", tx,ty); break; case 100100: text("c", tx,ty); break; case 100110: text("d", tx,ty); break; case 100010: text("e", tx,ty); break; case 110100: text("f", tx,ty); break; case 110110: text("g", tx,ty); break; case 110010: text("h", tx,ty); break; case 10100: text("i", tx,ty); break; case 10110: text("j", tx,ty); break; case 101000: text("k", tx,ty); break; case 111000: text("l", tx,ty); break; case 101100: text("m", tx,ty); break; case 101110: text("n", tx,ty); break; case 101010: text("o", tx,ty); break; case 111100: text("p", tx,ty); break; case 111110: text("q", tx,ty); break; case 111010: text("r", tx,ty); break; case 11100: text("s", tx,ty); break; case 11110: text("t", tx,ty); break; case 101001: text("u", tx,ty); break; case 111001: text("v", tx,ty); break; case 10111: text("w", tx,ty); break; case 101101: text("x", tx, ty); break; case 101111: text("y", tx, ty); break; case 101011: text("z", tx, ty); break; case 111011: text("á", tx, ty); break; case 11101: text("é", tx, ty); break; case 1100: text("í", tx, ty); break; case 1101: text("ó", tx, ty); break; case 11111: text("ú", tx, ty); break; case 110011: text("ü", tx, ty); break; case 110111: text("ñ", tx, ty); break; case 1000: text(".", tx, ty); break; case 1111: text("(num)", tx, ty); break; case 101: text("Mayúsc.", tx, ty); break; case 10000: text(",", tx, ty); break; case 10001: text("¿?", tx, ty); break; case 11000: text(";", tx, ty); break; case 11010: text("¡!", tx, ty); break; case 11001: text("''", tx, ty); break; case 110001: text("(", tx, ty); break; case 1110: text(")", tx, ty); break; case 1001: text("-", tx, ty); break; } }