213
edits
|  (Solution for exercise IV added) | |||
| Line 1,010: | Line 1,010: | ||
| [http://processing.org/learning/text/ Strings and Drawing Text in Processing] <br /> | [http://processing.org/learning/text/ Strings and Drawing Text in Processing] <br /> | ||
| <br /><br /> | <br /><br /> | ||
| === SOLUTION: Exercise IV === | |||
| [[File:Processing_hello_world_mouse_writer.png|200px|thumb]] | |||
| <source lang="java"> | |||
| PFont mySerif; | |||
| char[] letters = {'H','E','L','L','O',' ','W','O','R','L','D',' '}; | |||
| int curPos = 0; | |||
| void setup() { | |||
|   size(400,400); | |||
|   smooth(); | |||
|   mySerif = loadFont("Serif-48.vlw"); | |||
|   textAlign(CENTER); | |||
|   textFont(mySerif, 32); | |||
|   background(0); | |||
|   frameRate(5); | |||
| } | |||
| void draw() { | |||
|   fill(200,200,200,100); | |||
|   translate(mouseX,mouseY); | |||
|   text( char(letters[curPos]), 0, 0); | |||
|   curPos++; | |||
|   if(curPos == letters.length){ | |||
|     curPos = 0; | |||
|   } | |||
| } | |||
| </source> | |||
| <br /> <br /> | |||
| [[Category:Physical Computing]] | [[Category:Physical Computing]] | ||
| [[Category:Frederic Gmeiner]] | [[Category:Frederic Gmeiner]] | ||
| [[Category:WS11]] | [[Category:WS11]] | ||
edits