/** * Teleprompter * * Simple program to scroll a text file vertically, on a blue * background. Intended for use with a partially-silvered * mirror, as a teleprompter. * * For remote control, uses application iRed Lite to * interface with Mac Remote: * http://www.filewell.com/iRedLite/ * * robert.twomey@gmail.com * */ import oscP5.*; OscP5 oscP5; PFont fontA; final int FONT_SIZE=50; final color BG=#FFFFFF; final color TXT=#000000; final int margin = 10; void setup() { size(1280, 1024); //size(screen.width, screen.height); background(BG); smooth(); // Load the font. Fonts must be placed within the data // directory of your sketch. A font must first be created // using the 'Create Font...' option in the Tools menu. // Uncomment the following two lines to see the available fonts //String[] fontList = PFont.list(); //println(fontList); textAlign(CENTER, CENTER); fontA = createFont("Helvetica-Bold", 255); fill(TXT); textFont(fontA, FONT_SIZE); /* start oscP5, listening for incoming messages at port 12000 */ oscP5 = new OscP5(this, 12000); } void drawPrompt(String prompt) { background(BG); fill(TXT); // text(prompt, 50, 50, 690, 430); text(prompt, margin, margin, width-margin, height-margin); } /* incoming osc message are forwarded to the oscEvent method. */ void oscEvent(OscMessage theOscMessage) { /* print the address pattern and the typetag of the received OscMessage */ // println("### received an osc message."); // println(" addrpattern: "+theOscMessage.addrPattern()); // println(" typetag: "+theOscMessage.typetag()); String addrpat = theOscMessage.addrPattern(); String strval = theOscMessage.get(0).stringValue(); //println(theOscMessage.toString()); //theOscMessage.print(); //theOscMessage.printData(); if (match(addrpat, "/promptme")!=null) { println("Received: "+strval); drawPrompt(strval); } } void draw() { }