changeset 10:a8f71b5bdb0e

Toned down colours, increased buffer zone, added visual constraint feedback.
author samer
date Fri, 27 Jan 2012 09:23:43 +0000
parents 3dff71c0e7fd
children 066104f9a2e2
files src/Voice.cpp src/melodyTriangle.cpp
diffstat 2 files changed, 31 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/Voice.cpp	Fri Jan 27 08:52:54 2012 +0000
+++ b/src/Voice.cpp	Fri Jan 27 09:23:43 2012 +0000
@@ -14,7 +14,7 @@
 	posx=x;
 	posy=y;
 	isActive=true;
-	radius=15;
+	radius=12;
 	inTriangle=false;
 	octave=0;
 	highlight=false;
@@ -23,20 +23,19 @@
 Voice::Voice(){}
 
 void Voice::draw(){
-	ofSetColor(255,0,0);
+	ofSetColor(200,0,0);
 	
 	if (isActive){
-		
 		ofFill();
-	}else {
+	} else {
 		ofNoFill();
 	}
 	ofCircle(posx, posy, radius);
 	if (highlight){
-		ofNoFill();
-		ofSetColor(255, 255, 255);
-		ofCircle(posx, posy, radius);
-	}
+		ofSetColor(255, 192, 192);
+	}	
+	ofNoFill();
+	ofCircle(posx, posy, radius);
 }
 
 bool Voice::isInVoice(int x, int y){
--- a/src/melodyTriangle.cpp	Fri Jan 27 08:52:54 2012 +0000
+++ b/src/melodyTriangle.cpp	Fri Jan 27 09:23:43 2012 +0000
@@ -1,6 +1,7 @@
 #include "melodyTriangle.h"
 #include <GLUT/GLUT.h> 
 
+#define BUFFER_ZONE 50 // have to drag this far to snap out of triange.
 /*
  /birth id
  /death id
@@ -124,13 +125,8 @@
 
 //--------------------------------------------------------------
 void melodyTriangle::draw(){
-
+	bool constrained=false;
 	
-	//let's draw our triangle
-	ofSetColor(0,0,255);
-	
-	ofFill();		
-	ofTriangle(x1, y1, x2, y2, x3, y3);
 	bool sendStart=false;
 	if (voiceGrabbed!=-1){
 		if (mouseX!=(*voices[voiceGrabbed]).posx || mouseY!=(*voices[voiceGrabbed]).posy){
@@ -139,22 +135,23 @@
 			if ((*voices[voiceGrabbed]).inTriangle && !isInTriangle(mouseX,mouseY)){
 			    ///death id
 				
-				if (ofDist((*voices[voiceGrabbed]).posx, (*voices[voiceGrabbed]).posy, mouseX, mouseY) > (*voices[voiceGrabbed]).radius*2){ 
+				if (ofDist((*voices[voiceGrabbed]).posx, (*voices[voiceGrabbed]).posy, mouseX, mouseY)
+					> BUFFER_ZONE) { 
 				
 					
-				ofxOscMessage m;
-				///track id x y left right top bottom area  
-				m.setAddress( "/death" );
-				m.addIntArg( (*voices[voiceGrabbed]).id );
-				sender.sendMessage( m );
+					ofxOscMessage m;
+					///track id x y left right top bottom area  
+					m.setAddress( "/death" );
+					m.addIntArg( (*voices[voiceGrabbed]).id );
+					sender.sendMessage( m );
 				
-				printf("sent /death %i \n",(*voices[voiceGrabbed]).id);
-				(*voices[voiceGrabbed]).posx=mouseX;
-				(*voices[voiceGrabbed]).posy=mouseY;
-
+					printf("sent /death %i \n",(*voices[voiceGrabbed]).id);
+					(*voices[voiceGrabbed]).posx=mouseX;
+					(*voices[voiceGrabbed]).posy=mouseY;
 				} else {
 					//printf("e");
 					//On Edge
+					constrained=true;
 				}
 
 			}else{
@@ -199,6 +196,17 @@
 			
 		}
 	};
+
+	//let's draw our triangle
+	ofSetColor(128,128,128);
+	ofFill();		
+	ofTriangle(x1, y1, x2, y2, x3, y3);
+	if (constrained) ofSetColor(255,128,128);
+
+	// draw smooth edge, brighter if a token is constrained
+	ofNoFill();		
+	ofTriangle(x1, y1, x2, y2, x3, y3);
+	
 	for (int i=0; i<numVoices; i++){
 		(*voices[i]).draw();
 	}