// (c) Alex McLean 2005 // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. Environment environment; OscP5 osc; Map images = new HashMap( ); void setup () { environment = new Environment(800, 600); framerate(8); initOsc(); } void initOsc() { osc = new OscP5( this, "127.0.0.1", 12001, 12000, "incoming" ); } void incoming (OscIn oscIn) { if(oscIn.checkAddrPattern("/trigger")) { String typeTag = oscIn.getTypetag(); //println(typeTag); int c = typeTag.length(); int i = 0; // ugly code because java doesn't have closures and introspection // is hard float x = oscIn.getFloat(i++); float y = oscIn.getFloat(i++); float speed = oscIn.getFloat(i++); float direction = oscIn.getFloat(i++); float volume = oscIn.getFloat(i++); float width = oscIn.getFloat(i++); float length = oscIn.getFloat(i++); int reverb = oscIn.getInt(i++); float curve = oscIn.getFloat(i++); String imageFn = oscIn.getString(i++); environment.addThing(x, y, speed, direction, volume, width, length, reverb, curve, imageFn); } } void draw() { background(0); for (int i = 0; i < 3; ++i) { environment.tick(); } environment.draw(); }