Basic changes to support new layout
[SugarCubes.git] / _Internals.pde
index 3bf4d3199572b85cfe9370ada56c689bd1477004..88ea2e0a5e12f8db17b622ae0a23d483e2a17309 100644 (file)
@@ -53,6 +53,7 @@ boolean mappingMode = false;
 boolean pandaBoardsEnabled = false;
 
 boolean debugMode = false;
+DebugUI debugUI;
 
 // Camera variables
 float eyeR, eyeA, eyeX, eyeY, eyeZ, midX, midY, midZ;
@@ -93,6 +94,7 @@ void setup() {
   // Build overlay UI
   ui = controlUI = new ControlUI();
   mappingUI = new MappingUI(mappingTool);
+  debugUI = new DebugUI(frontChannels, rearChannels);
   logTime("Built overlay UI");
     
   // MIDI devices
@@ -101,7 +103,7 @@ void setup() {
   }
   SCMidiDevices.initializeStandardDevices(glucose);
   logTime("Setup MIDI devices");
-  
+    
   // Setup camera
   midX = glucose.model.xMax/2 + 20;
   midY = glucose.model.yMax/2;
@@ -149,6 +151,10 @@ void draw() {
   // Draws the simulation and the 2D UI overlay
   background(40);
   color[] colors = glucose.getColors();
+  if (debugMode) {
+    debugUI.maskColors(colors);
+  }
+  
   camera(
     eyeX, eyeY, eyeZ,
     midX, midY, midZ,
@@ -156,7 +162,7 @@ void draw() {
   );
   stroke(#333333);
   fill(#292929);
-  float yFloor = -3;
+  float yFloor = -2;
   beginShape();
   vertex(0, yFloor, 0);
   vertex(glucose.model.xMax, yFloor, 0);
@@ -170,6 +176,7 @@ void draw() {
   for (Point p : glucose.model.points) {
     stroke(colors[p.index]);
     vertex(p.fx, p.fy, p.fz);
+    // println(p.fx + ":" + p.fy + ":" + p.fz);
   }
   endShape();
   
@@ -181,6 +188,10 @@ void draw() {
   strokeWeight(1);
   drawUI();
   
+  if (debugMode) {
+    debugUI.draw();
+  }
+  
   // TODO(mcslee): move into GLucose engine
   if (pandaBoardsEnabled) {
     pandaFront.send(colors);
@@ -216,6 +227,7 @@ void keyPressed() {
     case 'd':
       debugMode = !debugMode;
       println("Debug output: " + (debugMode ? "ON" : "OFF"));
+      break;
     case 'm':
       mappingMode = !mappingMode;
       if (mappingMode) {
@@ -250,6 +262,9 @@ void mousePressed() {
   if (mouseX > ui.leftPos) {
     ui.mousePressed();
   } else {
+    if (debugMode) {
+      debugUI.mousePressed();
+    }    
     mx = mouseX;
     my = mouseY;
   }