nickytenera09
YaBB Newbies
Offline
Posts: 8
graphic things!
Jun 10th , 2009, 1:03pm
i would like to create a graphic project in order to use the keybord to obtain shapes... exemples: if a write SQUARE a have a square, if a write LINE i have a line...etc... so for each sequence of word, have the shape of the meaning. I've already compiled something very simple, like every initial (L for Line) for a shape.. but i cannot use the strings or the charAt() to substitute the keypressed value with the entire word... Someone can help me!? this is my work till now... i'm a beginner... very beginner! thanks to all! void setup () { size (400,400); background (255,255,255); } void draw (){ if (keyPressed) { if (key == 'r' || key == 'R'){ rect (50,5,50,25); stroke (255,0,255); fill (255,0,255); } } if (keyPressed) { if (key == 'c' || key == 'C'){ ellipseMode (CENTER); ellipse (200,200,50,50); stroke (0,255,0); fill (0,255,0); } } if (keyPressed) { if (key == 'l' || key == 'L' ){ line (250,250,350,30); strokeCap (ROUND); strokeWeight (8); stroke(255,0,0); } } if (keyPressed) { if (key == 's' || key == 'S'){ beginShape(LINES); vertex(111,106); vertex(116,120); vertex(116,120); vertex(130,120); vertex(130,120); vertex(120,131); vertex(120,131); vertex(123,143); vertex(123,143); vertex(110,135); vertex(110,135); vertex(97,143); vertex(97,143); vertex(99,131); vertex(99,131); vertex(91,120); vertex(91,120); vertex(105,120); vertex(105,120); vertex(111,106); endShape (CLOSE); stroke(255,255,0); strokeWeight(4); } } if (keyPressed) { if (key == 'e' || key == 'E'){ ellipseMode (CENTER); ellipse (300,300,30,60); fill (0,255,255); stroke (0,255,255); } } if (keyPressed) { if (key == 't' || key == 'T'){ triangle(70,320,40,300,20,370); fill(0,0,255); stroke(0,0,255); } } if (keyPressed) { if (key == 'q' || key == 'Q' ){ rect(150,360,30,30); strokeWeight(5); stroke(0,0,0); fill(0,0,0); } } if (keyPressed) { if (key == 'p' || key == 'P' ){ point(180,90); strokeWeight(10); stroke(205,105,0,150); } } } i hope to hear someone as soon as possible! thanks Nicole