void Desk::addFile (QFileInfo &file, const QString &dir) { File *f; // if we already know about this file, ignore it f = findFile (file.fileName ()); if (f) return; // if not a .max file, ignore for the moment // if (file->fileName ().right (4) != ".max") // return; // ignore maxdesk.ini and ppthumbs.ptn as these are special files if (file.fileName ().find ("maxdesk.ini", 0, FALSE) != -1 || file.fileName ().find ("paperportsave.reg", 0, FALSE) != -1 || file.fileName ().find ("ppthumbs.ptn", 0, FALSE) != -1) return; // if not then find a good position for it, and add it // printf ("not found %s\n", file->fileName ().latin1 ()); f = createFile (dir, file.fileName ()); f->setPos (_pos); _files << f; dirty (); // advance pos advanceOne (); }
void Desk::advance (void) { // start at top _pos = QPoint (POS_leftmargin, POS_topmargin); File *f; // put the pos level with the bottom most item // also find the rightmost item foreach (f, _files) { if (f->pos ().y () >= _pos.y ()) { if (f->pos ().y () > _pos.y ()) { _pos.setY (f->pos ().y ()); _pos.setX (POS_leftmargin); } while (_pos.y () == f->pos ().y () && _pos.x () < f->pos ().x ()) advanceOne (); } } // now keep advancing pos until it doesn't clash with an existing item for (int i = 0; i < 1000 && clashes (_pos); i++) advanceOne (); /* _pos.setX (_pos.x () + POS_xstep); if (_pos.x () >= _rightMargin) { _pos.setX (0); _pos.setY (_pos.y () + POS_ystep); } */ }
void Desk::addFile (File *f) { // set position and add to list f->setPos (_pos); _files << f; // we now have a dirty desk dirty (); // advance pos advanceOne (); // update our row count updateRowCount (); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if( key=='d' ){ copias[select].setShader("shaders/"+shaderFiles[nShader]); cout << select; }; if( key=='s' ){ copias[select].setShader("shaders/transpativo"); cout << select; }; if( key=='l' ){ loadSet(set); }; if( key=='c' ){ int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x); setupCopia(select, temp , "shaders/transparento"); //copias[select].setPos(ofGetMouseX() ,ofGetMouseX(),3,1); cout << copias.size(); }; if( key=='v' ){ copias[select].scaleX=ofRandom(5.0); }; if( key=='f' ){ set=max(set-1, 0); cout << set; nImage=0; }; if( key=='h' ){ cout << animationRefs.size() ; set=min(set+1, int(animationRefs.size()-1)); if (!animationsLoaded[set]) { loadSet(set); } //cout << min(set, ); nImage=0; //nImage++; }; if( key=='1' ){ select++; cout << select; }; if( key=='0' ){ select--; cout << select; // cout << max(copias.size(), select); // }; if( key=='b' ){ copias[select].glitch=true; // cout << max(copias.size(), select); // }; if( key=='n' ){ copias[select].glitch=false; // cout << max(copias.size(), select); // }; if( key=='z' ){ nShader=int(nShader+1)%int(shaderFiles.size()-1); // nShader++; // cout << max(copias.size(), select); // }; if( key=='x' ){ nShader=max(int(nShader-1), 0); // cout << max(copias.size(), select); // }; if( key=='p' ){ ofSaveFrame(); // cout << max(copias.size(), select); // }; if( key=='g' ){ //int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x); advanceOne(select); }; }
//-------------------------------------------------------------- void testApp::draw(){ // ofBackground(50, 50, 50); // ofBackground(80,80,20); ofBackgroundGradient( ofColor(180), ofColor(0), OF_GRADIENT_CIRCULAR); // ofSetColor(245, 58, 135); ofColor color = ofColor(100,100,100); //int temp=animationRefs[set].x+ofRandom(animationRefs[set].y-animationRefs[set].x); for(vector<paperclip>::iterator it = copias.begin(); it != copias.end(); ++it){ if((it)->alive){ (it)->draw(color); } } //SOUND static int index=0; float avg_power = 0.0f; myfft.powerSpectrum(0,(int)BUFFER_SIZE/2, left,BUFFER_SIZE,&magnitude[0],&phase[0],&power[0],&avg_power); /* start from 1 because mag[0] = DC component */ /* and discard the upper half of the buffer */ for(int j=1; j < BUFFER_SIZE/2; j++) { freq[index][j] = magnitude[j]; } /* draw the FFT */ for (int i = 1; i < (int)(BUFFER_SIZE/2); i++){ ofLine(200+(i*8),400,200+(i*8),400-magnitude[i]*10.0); ofLine(200+(i*8),400,200+(i*8),400+magnitude[i]*10.0); //int sl = ofMap( magnitude[i]*10.0, 0, 500, 0, animationRefs[set].z); // cout <<" "<< magnitude[i]*10.0 << " " ; // if (magnitude[i]) { // statements // } } if (magnitude[20]*10>50) { advanceOne(select); } ///INFO string info = infoarray; info += "Press [1] select- ["+ofToString(select)+"]\n"; info += "Press [0] set+ ["+ofToString(set)+"]\n"; info += "GLITCHY?: "+ofToString(copias[select].glitch)+"\n"; info +="SETIMAGES FROM: "+ofToString(animationRefs[set].x)+" TO: "+ofToString(animationRefs[set].y)+"\n"; info +="nSetImages: "+ofToString(animationRefs[set].z)+"\n"; info += "NIMage "+ofToString(nImage)+"\n"; info += "IMAGE "+ofToString(imagePaths[animationRefs[set].x+nImage])+"\n"; info += "nShader "+ofToString(nShader)+"\n"; info += "SHADER "+ofToString(shaderFiles[nShader])+"\n\n"; ofSetHexColor(0x000000); ofRect(10, 10, 250, 150); ofSetHexColor(0xFFFFFF); ofDrawBitmapString(info, 30, 30); rooom.drawString("", 300, 350); }