annotate src/Voice.cpp @ 6:d879a30556f8

re-intital commit
author Henrik Ekeus <hekeus@eecs.qmul.ac.uk>
date Wed, 25 Jan 2012 16:30:07 +0000
parents
children a8f71b5bdb0e
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;
hekeus@6 17 radius=15;
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(){
hekeus@6 26 ofSetColor(255,0,0);
hekeus@6 27
hekeus@6 28 if (isActive){
hekeus@6 29
hekeus@6 30 ofFill();
hekeus@6 31 }else {
hekeus@6 32 ofNoFill();
hekeus@6 33 }
hekeus@6 34 ofCircle(posx, posy, radius);
hekeus@6 35 if (highlight){
hekeus@6 36 ofNoFill();
hekeus@6 37 ofSetColor(255, 255, 255);
hekeus@6 38 ofCircle(posx, posy, radius);
hekeus@6 39 }
hekeus@6 40 }
hekeus@6 41
hekeus@6 42 bool Voice::isInVoice(int x, int y){
hekeus@6 43 if (ofDist(x, y, posx, posy)<=radius){
hekeus@6 44 return true;
hekeus@6 45 }else {
hekeus@6 46 return false;
hekeus@6 47 }
hekeus@6 48
hekeus@6 49 }
hekeus@6 50