Permalink
Browse files

more tutorial writing

  • Loading branch information...
1 parent 5263c87 commit abd394fdb87fa1fa2484bb686ac76487f043e001 @Pomax committed Jul 17, 2012
View
@@ -10,7 +10,7 @@
* can make use of it.
*/
abstract class Actor extends Positionable {
- boolean debug = true;
+ boolean debug = false;
// debug bounding box alignment
float halign=0, valign=0;
View
@@ -14,6 +14,7 @@ import ddf.minim.analysis.*;
import ddf.minim.effects.*;
static class SoundManager {
+ static boolean reportErrors = false;
private static PApplet sketch;
private static Minim minim;
@@ -97,7 +98,7 @@ static class SoundManager {
rewind(identifier);
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.play();
@@ -113,7 +114,7 @@ static class SoundManager {
rewind(identifier);
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.loop();
@@ -125,7 +126,7 @@ static class SoundManager {
static void pause(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.pause();
@@ -137,7 +138,7 @@ static class SoundManager {
static void rewind(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.rewind();
@@ -149,7 +150,7 @@ static class SoundManager {
static void stop(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.pause();
View
@@ -10,7 +10,7 @@
* can make use of it.
*/
abstract class Actor extends Positionable {
- boolean debug = true;
+ boolean debug = false;
// debug bounding box alignment
float halign=0, valign=0;
@@ -693,11 +693,11 @@ class Boundary extends Positionable {
*/
String toString() { return x+","+y+","+xw+","+yh; }
}
-/**
- * Things can listen to boundary collisions for a boundary
- */
-interface BoundaryCollisionListener {
- void collisionOccured(Boundary boundary, Actor actor, float[] intersectionInformation);
+/**
+ * Things can listen to boundary collisions for a boundary
+ */
+interface BoundaryCollisionListener {
+ void collisionOccured(Boundary boundary, Actor actor, float[] intersectionInformation);
}/**
* A bounded interactor is a normal Interactor with
* one or more boundaries associated with it.
@@ -3067,6 +3067,7 @@ import ddf.minim.analysis.*;
import ddf.minim.effects.*;
static class SoundManager {
+ static boolean reportErrors = false;
private static PApplet sketch;
private static Minim minim;
@@ -3150,7 +3151,7 @@ static class SoundManager {
rewind(identifier);
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.play();
@@ -3166,7 +3167,7 @@ static class SoundManager {
rewind(identifier);
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.loop();
@@ -3178,7 +3179,7 @@ static class SoundManager {
static void pause(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.pause();
@@ -3190,7 +3191,7 @@ static class SoundManager {
static void rewind(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.rewind();
@@ -3202,7 +3203,7 @@ static class SoundManager {
static void stop(Object identifier) {
AudioPlayer ap = owners.get(identifier);
if(ap==null) {
- println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
+ if(reportErrors) println("ERROR: Error in SoundManager, no AudioPlayer exists for "+identifier.toString());
return;
}
ap.pause();
View
@@ -0,0 +1,32 @@
+/**
+ * Pjs object monitor
+ */
+var ProcessingInspector = {
+ monitor: function(object, attr, callback) {
+ var prev = object;
+ while(object && object[attr]) { prev = object; object = object.baseClass; }
+ object = prev;
+
+ // kill off property
+ var _cached = object[attr];
+ delete(object[attr]);
+
+ // Lift up this property using a closure
+ props = (function(attr, v) {
+ var lifted_value = v;
+ props = {
+ get : function() { return lifted_value; },
+ set : function(v) {
+ if (v!=lifted_value) {
+ lifted_value = v;
+ callback(object, attr, v);
+ }
+ },
+ configurable : true,
+ enumerable : true };
+ return props;
+ }(attr, _cached));
+
+ Object.defineProperty(object, attr, props);
+ }
+};
Oops, something went wrong.

0 comments on commit abd394f

Please sign in to comment.