Mercurial > hg > screen-ui
comparison src/melodyTriangle.cpp @ 16:add71da95cb4
Reduced buffer zone a bit, minor code simplification.
author | samer |
---|---|
date | Tue, 31 Jan 2012 12:51:35 +0000 |
parents | 9d7e139cd0a3 |
children | 9a414ea6880d |
comparison
equal
deleted
inserted
replaced
15:9d7e139cd0a3 | 16:add71da95cb4 |
---|---|
1 #include "melodyTriangle.h" | 1 #include "melodyTriangle.h" |
2 #include <GLUT/GLUT.h> | 2 #include <GLUT/GLUT.h> |
3 | 3 |
4 #define BUFFER_ZONE 80 // have to drag this far to snap out of triange. | 4 #define BUFFER_ZONE 64 // have to drag this far to snap out of triange. |
5 /* | 5 /* |
6 /birth id | 6 /birth id |
7 /death id | 7 /death id |
8 /start id | 8 /start id |
9 /stop id | 9 /stop id |
337 } | 337 } |
338 | 338 |
339 //-------------------------------------------------------------- | 339 //-------------------------------------------------------------- |
340 void melodyTriangle::mouseMoved(int x, int y ){ | 340 void melodyTriangle::mouseMoved(int x, int y ){ |
341 for (int i=0; i<numVoices;i++){ | 341 for (int i=0; i<numVoices;i++){ |
342 if ((*voices[i]).isInVoice(x,y)){ | 342 voices[i]->highlight = voices[i]->isInVoice(x,y); |
343 (*voices[i]).highlight=true; | 343 } |
344 }else { | |
345 (*voices[i]).highlight=false; | |
346 } | |
347 | |
348 } | |
349 | |
350 | |
351 } | 344 } |
352 | 345 |
353 //-------------------------------------------------------------- | 346 //-------------------------------------------------------------- |
354 void melodyTriangle::mouseDragged(int x, int y, int button){ | 347 void melodyTriangle::mouseDragged(int x, int y, int button){ |
355 | 348 |
357 | 350 |
358 //-------------------------------------------------------------- | 351 //-------------------------------------------------------------- |
359 void melodyTriangle::mousePressed(int x, int y, int button){ | 352 void melodyTriangle::mousePressed(int x, int y, int button){ |
360 | 353 |
361 for (int i=0; i<numVoices;i++){ | 354 for (int i=0; i<numVoices;i++){ |
362 if ((*voices[i]).isInVoice(x,y)){ | 355 if (voices[i]->isInVoice(x,y)){ |
363 voiceGrabbed=i; | 356 voiceGrabbed=i; |
364 //printf("grabbed %i",voiceGrabbed); | 357 //printf("grabbed %i",voiceGrabbed); |
365 }else{ | 358 }else{ |
366 //printf("didnt grab %i",i); | 359 //printf("didnt grab %i",i); |
367 } | 360 } |