Mercurial > hg > screen-ui
changeset 1:3b6ab3b28808
Add command line params for disabling keys
author | Henrik Ekeus <hekeus@eecs.qmul.ac.uk> |
---|---|
date | Tue, 24 Jan 2012 13:48:54 +0000 |
parents | 2db9be889344 |
children | 8c4903923021 |
files | main.cpp melodyTriangle.cpp melodyTriangle.h |
diffstat | 3 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/main.cpp Mon Jan 23 16:46:37 2012 +0000 +++ b/main.cpp Tue Jan 24 13:48:54 2012 +0000 @@ -21,6 +21,7 @@ // pass in width and height too: ofRunApp( new melodyTriangle(argc>1 ? argv[1] : HOST, argc>2 ? atoi(argv[2]) : PORT, - argc>3 ? atoi(argv[3]) : NUMVOICES)); + argc>3 ? atoi(argv[3]) : NUMVOICES, + argc>5 ? atoi(argv[5]) : true)); }
--- a/melodyTriangle.cpp Mon Jan 23 16:46:37 2012 +0000 +++ b/melodyTriangle.cpp Tue Jan 24 13:48:54 2012 +0000 @@ -11,10 +11,10 @@ */ -melodyTriangle::melodyTriangle(const char *host, int port, int numVoices){ - printf("in constructor: %s %i %i\n",host,port,numVoices); +melodyTriangle::melodyTriangle(const char *host, int port, int numVoices, bool enableKeys){ + printf("in constructor: %s %i %i %i\n",host,port,numVoices,enableKeys); this->numVoices=numVoices; - + this->enableKeys=enableKeys; //voices=*Voice[numVoices]; sender.setup( host,port ); } @@ -180,6 +180,7 @@ //-------------------------------------------------------------- void melodyTriangle::keyPressed (int key){ //printf("key %i",key); + if (enableKeys){ if (key == 'a'){ for (int i=0; i<numVoices; i++){ if ((*voices[i]).isInVoice(mouseX,mouseY)){ @@ -370,7 +371,7 @@ } } } - + } } //--------------------------------------------------------------
--- a/melodyTriangle.h Mon Jan 23 16:46:37 2012 +0000 +++ b/melodyTriangle.h Tue Jan 24 13:48:54 2012 +0000 @@ -12,7 +12,7 @@ class melodyTriangle : public ofBaseApp{ public: - melodyTriangle(const char *host, int port, int numVoices); + melodyTriangle(const char *host, int port, int numVoices, bool enableKeys); void setup(); void update(); @@ -26,6 +26,7 @@ void mouseReleased(int x, int y, int button); void windowResized(int w, int h); int numVoices; + bool enableKeys; float counter; bool bSmooth; //Voice *voices[NUMVOICES];