/* * Haiku * * Demonstration of using loadStrings to read from a file, and loadFont * * Created 10/17/2007 by spc */ color bg = color(232, 221, 176); color textColor = color(37, 48, 155); String[] lines; int i = 0; void setup() { lines = loadStrings("haiku.txt"); size(300, 300); background(bg); // load a decent font PFont pf = loadFont("LucidaBright-Italic-18.vlw"); textFont(pf); noLoop(); } void draw() { fill(textColor); // assumes 3 lines, then blank text(lines[i++], 15, 50); text(lines[i++], 15, 100); text(lines[i++], 15, 150); i++; } void mousePressed() { // clear screen by overlaying a rect in the same background color noStroke(); fill(bg); rect(0, 0, 300, 300); // redraw redraw(); }