PFont f; int vspacing = 24; int xindent = 10; float lwidth; Cursor curs; Buffer buffer; int totalLines; int currentLine = 0; int bufferMax = 25; String input = ""; void setup() { size(640,480); f = loadFont("CourierNewPS-BoldMT-16.vlw"); textFont(f); lwidth = textWidth(" "); curs = new Cursor(); buffer = new Buffer(); buffer.add("Welcome to the Processing command line emulator!"); buffer.add("This currently has very little functionality."); buffer.add("No word wrap."); buffer.add("No nothing."); buffer.add("I am going to make it into a fully functional library"); buffer.add("Ok, click in the applet window and start typing!!"); buffer.add("> "); totalLines = height/vspacing - 1; currentLine = constrain(buffer.size(),0,totalLines); noLoop(); redraw(); } void draw() { background(0); textFont(f); fill(0,255,0); int start = constrain(buffer.size()-totalLines,0,bufferMax); for (int i = start; i < buffer.size(); i++) { String message = (String) buffer.get(i); text(message,xindent,vspacing*(i-start+1)); } String theend = (String) buffer.get(buffer.size()-1); int len = theend.length(); curs.setPos(len+1,buffer.size()); curs.render(); }