summaryrefslogtreecommitdiff
path: root/liveengine/src/testApp.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-09-02 12:18:44 +0100
committerTim Redfern <tim@eclectronics.org>2012-09-02 12:18:44 +0100
commit65cf7b27e9d2f9e59da322b4fbad1ed1df27eb8d (patch)
tree3b2bfbca45418bfdeeb1f07553cef88c01e165e4 /liveengine/src/testApp.cpp
parent34a459de430dd35034ec9404fe7ec54407641085 (diff)
v 0.1
Diffstat (limited to 'liveengine/src/testApp.cpp')
-rwxr-xr-xliveengine/src/testApp.cpp54
1 files changed, 40 insertions, 14 deletions
diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp
index 0d8ec28..c23ec86 100755
--- a/liveengine/src/testApp.cpp
+++ b/liveengine/src/testApp.cpp
@@ -28,8 +28,9 @@ void testApp::setup(){
memset(controllers,NUM_CONTROLLERS,0);
note=0;
- controller_colours=new ofColor[NUM_CONTROLLERS];
- for (int i=0;i<NUM_CONTROLLERS;i++) controller_colours[i]=ofColor::fromHsb(ofRandom(255), 255, 255);
+ makeColours();
+
+ controlColours=false;
grab.allocate(ofGetWidth(), ofGetHeight(),GL_RGB);
//grab.setUseTexture(true);
@@ -39,8 +40,10 @@ void testApp::setup(){
ofSetBackgroundAuto(false);
- xshift=1;
- yshift=1;
+ xshift=-1;
+ yshift=-1;
+
+
mode=BLOCKS;
@@ -48,9 +51,19 @@ void testApp::setup(){
decayTime=2.0f;
//ofSetVerticalSync(true); deosn't seem effective
- //glXSwapIntervalSGI(1);
+ //glXSwapIntervalSGI(1);
+ /*
+ printf("hue of red is %f\n",ofColor(255,0,0).getHue());
+ printf("hue of green is %f\n",ofColor(0,255,0).getHue());
+ printf("hue of blue is %f\n",ofColor(0,0,255).getHue());
+ hue is float from 0.0-255.0
+ */
}
+void testApp::makeColours() {
+ controller_colours=new ofColor[NUM_CONTROLLERS];
+ for (int i=0;i<NUM_CONTROLLERS;i++) controller_colours[i]=ofColor::fromHsb(ofRandom(255), 255, 255);
+}
//--------------------------------------------------------------
void testApp::update(){
//for (int i=0;i<numLayers;i++) layers[i]->update();
@@ -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;
+ }
}
//--------------------------------------------------------------