From 65cf7b27e9d2f9e59da322b4fbad1ed1df27eb8d Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 2 Sep 2012 12:18:44 +0100 Subject: v 0.1 --- liveengine/src/layers.cpp | 56 +++++++++++++++++++++++----------------- liveengine/src/layers.h | 17 +++++++----- liveengine/src/playlist.cpp | 63 ++++++++++++++++++++++++++------------------- liveengine/src/playlist.h | 2 ++ liveengine/src/testApp.cpp | 54 ++++++++++++++++++++++++++++---------- liveengine/src/testApp.h | 7 +++-- 6 files changed, 125 insertions(+), 74 deletions(-) (limited to 'liveengine/src') diff --git a/liveengine/src/layers.cpp b/liveengine/src/layers.cpp index 3ae7810..d2698ef 100644 --- a/liveengine/src/layers.cpp +++ b/liveengine/src/layers.cpp @@ -1,24 +1,5 @@ #include "layers.h" -layer::layer() {} -layer::layer(string _f) -{ - load(_f); -} - -void layer::load(string _f){ -} - -void layer::draw(float a) { - -} - -layer::~layer() -{ - //dtor -} - - svglayer::svglayer() { xo=0;yo=0; } @@ -45,6 +26,19 @@ void svglayer::draw(float a) { svg.getPathAt(i).setFillColor(fills[i]*a); svg.getPathAt(i).draw(xo,yo); } +} +void svglayer::draw(float a,unsigned char* controllers) { + //draw layers tinted by controllers + for (int i=0;iupdate(); @@ -60,10 +73,14 @@ void testApp::update(){ void testApp::draw(){ ofSetColor(255,255,255); grab.loadScreenData( 0, 0, ofGetWidth(), ofGetHeight() ); - //grab.update(); - //grab.reloadTexture(); - //ofBackground(0,0,0); - grab.draw( xshift,yshift); + + /* can this work? + grab.setAnchorPoint(xshift,yshift); + grab.setTextureWrap( GL_WRAP_BORDER, GL_WRAP_BORDER); + grab.draw(0,0); // xshift,yshift); + */ + int startx=(xshift>0?xshift-ofGetWidth():xshift); + int starty=(yshift>0?yshift-ofGetHeight():yshift); float notewidth=ofGetWidth()/NUM_NOTES; float noteheight=ofGetHeight()/NUM_CONTROLLERS; @@ -82,7 +99,10 @@ void testApp::draw(){ if (list.lock()) { //if playlist is loaded ofPushMatrix(); //ofScale(sin(ofGetElapsedTimef())+1.1,sin(ofGetElapsedTimef())+1.1); - if (list.layers.find(note)!=list.layers.end()) list.layers[note]->draw(lamda); + if (list.layers.find(note)!=list.layers.end()) { + if (controlColours) list.layers[note]->draw(lamda,controllers); + else list.layers[note]->draw(lamda); + } ofPopMatrix(); list.unlock(); } @@ -121,18 +141,24 @@ void testApp::keyPressed (int key){ mode=key-'0'; } if(key == OF_KEY_LEFT){ - xshift--; + xshift++; + } if(key == OF_KEY_RIGHT){ - xshift++; + xshift--; } if(key == OF_KEY_DOWN){ yshift--; } if(key == OF_KEY_UP){ - yshift++; + yshift++; } - + if(key == '='){ + makeColours(); + } + if(key == '-'){ + controlColours=!controlColours; + } } //-------------------------------------------------------------- diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h index 0f97068..af99c6a 100755 --- a/liveengine/src/testApp.h +++ b/liveengine/src/testApp.h @@ -95,14 +95,17 @@ class testApp : public ofBaseApp, public ofxMidiListener{ void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); + void makeColours(); + void toggleFPS(); bool showFPS; ofxXmlSettings XML; unsigned char* controllers; - int note, - mode; + int note, mode; + + bool controlColours; float lastnoteTime; float decayTime; -- cgit v1.2.3