PFont font; int currentTextLine = 0; String textLines[]; float textBlockWidth = 200; float fontLeading = 22; float fontSize = 20; void setup() { size(640,480); smooth(); framerate(15); font = loadFont("Accolade-Light-48.vlw"); // load in some test text textLines = loadStrings("TestText.txt"); } void draw() { smooth(); background(0); stroke(255); strokeWeight(3); float anchorX = 100; float anchorY = 100; float padding = 20; fontSize = 18; fontLeading = 20; textFont(font); textSize(fontSize); textLeading(fontLeading); textBlockWidth = 400; TextBlock tb = new TextBlock(textLines[currentTextLine],font,fontSize,fontLeading,textBlockWidth); fill(127,180); Bubble bub = new Bubble(anchorX + tb.getMaxActualTextWidth()/2, anchorY + tb.getTextBlockHeight() / 2 - fontSize, tb.getMaxActualTextWidth(), tb.getTextBlockHeight(), padding); bub.drawBubble(); fill(255); text(tb.getWrappedTextBlock(),anchorX,anchorY); text("Click on Screen to advance text", 10, fontSize + 2); //rect(anchorX - padding,anchorY-padding - fontSize,tb.getMaxActualTextWidth() + 2*padding, tb.getTextBlockHeight() + 2*padding); } void mousePressed() { currentTextLine=(currentTextLine+1)%textLines.length; }