annotate src/Voice.cpp @ 10:a8f71b5bdb0e
Toned down colours, increased buffer zone, added visual constraint feedback.
author |
samer |
date |
Fri, 27 Jan 2012 09:23:43 +0000 |
parents |
d879a30556f8 |
children |
317637282293 |
rev |
line source |
hekeus@6
|
1 /*
|
hekeus@6
|
2 * Voice.cpp
|
hekeus@6
|
3 * MelodyTriangle
|
hekeus@6
|
4 *
|
hekeus@6
|
5 * Created by Henrik Ekeus on 12/01/2012.
|
hekeus@6
|
6 * Copyright 2012 Queen Mary University of London. All rights reserved.
|
hekeus@6
|
7 *
|
hekeus@6
|
8 */
|
hekeus@6
|
9
|
hekeus@6
|
10 #include "Voice.h"
|
hekeus@6
|
11
|
hekeus@6
|
12 Voice::Voice(int id, int x, int y){
|
hekeus@6
|
13 this->id=id;
|
hekeus@6
|
14 posx=x;
|
hekeus@6
|
15 posy=y;
|
hekeus@6
|
16 isActive=true;
|
samer@10
|
17 radius=12;
|
hekeus@6
|
18 inTriangle=false;
|
hekeus@6
|
19 octave=0;
|
hekeus@6
|
20 highlight=false;
|
hekeus@6
|
21 }
|
hekeus@6
|
22
|
hekeus@6
|
23 Voice::Voice(){}
|
hekeus@6
|
24
|
hekeus@6
|
25 void Voice::draw(){
|
samer@10
|
26 ofSetColor(200,0,0);
|
hekeus@6
|
27
|
hekeus@6
|
28 if (isActive){
|
hekeus@6
|
29 ofFill();
|
samer@10
|
30 } else {
|
hekeus@6
|
31 ofNoFill();
|
hekeus@6
|
32 }
|
hekeus@6
|
33 ofCircle(posx, posy, radius);
|
hekeus@6
|
34 if (highlight){
|
samer@10
|
35 ofSetColor(255, 192, 192);
|
samer@10
|
36 }
|
samer@10
|
37 ofNoFill();
|
samer@10
|
38 ofCircle(posx, posy, radius);
|
hekeus@6
|
39 }
|
hekeus@6
|
40
|
hekeus@6
|
41 bool Voice::isInVoice(int x, int y){
|
hekeus@6
|
42 if (ofDist(x, y, posx, posy)<=radius){
|
hekeus@6
|
43 return true;
|
hekeus@6
|
44 }else {
|
hekeus@6
|
45 return false;
|
hekeus@6
|
46 }
|
hekeus@6
|
47
|
hekeus@6
|
48 }
|
hekeus@6
|
49
|