# HG changeset patch # User samer # Date 1327656223 0 # Node ID a8f71b5bdb0e619b876f58daf1f500e26827665a # Parent 3dff71c0e7fdeecccfbf8da1a034a75c834b0a8c Toned down colours, increased buffer zone, added visual constraint feedback. diff -r 3dff71c0e7fd -r a8f71b5bdb0e src/Voice.cpp --- 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){ diff -r 3dff71c0e7fd -r a8f71b5bdb0e src/melodyTriangle.cpp --- 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 +#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