void FboMaskManager::update(){ if(!hasAutoloaded){ editing = false; if(autoload){ mask.load(loadPath); drawToFboBlending(); } hasAutoloaded = true; } //if(drawToOutputs){ // drawToFboBlending(); // drawToOutputs = false; // } if (_editing != editing) { _editing = editing; if (_editing) { addListeners(); } else { removeListeners(); } } if(editing){ if(!blankOutput){ blankOutput = true; drawToFboBlending(); } if(hideMouseWhileEditing){ ofHideCursor(); } else { ofShowCursor(); } if(load){ mask.load(loadPath); load = false; } if(save){ mask.save(loadPath); save = false; } } else { ofShowCursor(); if(blankOutput){ blankOutput = false; drawToFboBlending(); } } }
void ofxMouseAutoHider::setEnabled(bool enabled) { if(this->enabled == enabled) { return; } this->enabled = enabled; ofShowCursor(); printf("----------------------Setting enabled\n"); cursorShowing = true; lastTimeMouseMoved = ofGetElapsedTimef(); if(enabled) { ofAddListener(ofEvents().update, this, &ofxMouseAutoHider::update); ofAddListener(ofEvents().mouseMoved, this, &ofxMouseAutoHider::mouseEvent); ofAddListener(ofEvents().mousePressed, this, &ofxMouseAutoHider::mouseEvent); ofAddListener(ofEvents().mouseDragged, this, &ofxMouseAutoHider::mouseEvent); ofAddListener(ofEvents().mouseReleased, this, &ofxMouseAutoHider::mouseEvent); } else { ofRemoveListener(ofEvents().update, this, &ofxMouseAutoHider::update); ofRemoveListener(ofEvents().mouseMoved, this, &ofxMouseAutoHider::mouseEvent); ofRemoveListener(ofEvents().mousePressed, this, &ofxMouseAutoHider::mouseEvent); ofRemoveListener(ofEvents().mouseDragged, this, &ofxMouseAutoHider::mouseEvent); ofRemoveListener(ofEvents().mouseReleased, this, &ofxMouseAutoHider::mouseEvent); } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key) { if (key == ' ') { goToNextText(); } if (key == 'a') { if (animating) { cameraPosTarget = cameraPosTarget.getNormalized() * zoomOutDist; cameraPosOld = cameraPosOld.getNormalized() * zoomOutDist; } animating = !animating; } if (key == 'f') { ofToggleFullscreen(); } if (key == 's') { fadingUp = !fadingUp; } if (key == 'g') { if (showGui) { ofHideCursor(); } else { ofShowCursor(); } showGui = !showGui; } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ // if(key == 'l'){ // cameraTrack->lockCameraToTrack = !cameraTrack->lockCameraToTrack; // } // else if(key == 't'){ // // NOTE: cannot edit keyframes, only add new ones! // cameraTrack->addKeyframe(); // } if (key == 'f') ofToggleFullscreen(); if (key == 'b') bDrawTimeline = !bDrawTimeline; if (key == 'n') bDrawPanel = !bDrawPanel; if (key == 'p') timeline.play(); if (key == 'r') { if (bRunTimelapse) { bRunTimelapse = false; } else { timelapse.reset(); bRunTimelapse = true; timeline.play(); } } if (key == 'c') { bHideCursor ? ofShowCursor() : ofHideCursor(); bHideCursor = !bHideCursor; } }
//-------------------------------------------------------------- // MARK: DRAW //-------------------------------------------------------------- void testApp::draw(){ fbo.begin(); glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_BLEND); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); ofSetColor(0, iFboAlpha); ofRect(0, 0, FBO_W, FBO_H); runParticles(streetParticles, *streetPath); runParticles(neighborhoodParticles, *neighborhoodPath); runParticles(cityParticles, *cityPath); glDisable(GL_BLEND); glPopAttrib(); fbo.end(); ofEnableAlphaBlending(); fbo.draw(0, 0); ofDisableAlphaBlending(); if(isGUIActive) { ofShowCursor(); drawGUI(); } else { ofHideCursor(); } }
//-------------------------------------------------------------- void captureApp::keyPressed(int key) { if(key == 'f') { ofToggleFullscreen(); } if(key == '\t') { if( !hidden && ofxFileHelper::doesFileExist(capturePrefix+"capture") && ofxFileHelper::doesFileExist(capturePrefix+"capture/0.jpg") ){ string unique = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds()); ofxFileHelper::moveFromTo(capturePrefix+"capture", capturePrefix+"savedFolder"+unique); ofxFileHelper::makeDirectory(capturePrefix+"capture"); cameraFrameNum = 0; } hidden = !hidden; panel.hidden = hidden; if(hidden) ofHideCursor(); else ofShowCursor(); if(!hidden) imageSaver.saveAll(); } if(panel.getValueB("frameByFrame") && key == OF_KEY_UP){ patternFrame--; } if(panel.getValueB("frameByFrame") && key == OF_KEY_DOWN){ patternFrame++; } }
void testApp::keyReleased(int key){ if (bMouse){ ofShowCursor(); } else { ofHideCursor(); } }
void sphereSystem::keyPressed(int key){ switch(key){ case '!': epi[oscTargetSlot].saveToXml("temp"); break; case '#': ofToggleFullscreen(); break; case '$': timeline.toggleShow(); if(timeline.getIsShowing()) ofShowCursor(); else ofHideCursor(); break; case OF_KEY_LEFT: break; case ' ': timeline.togglePlay(); //bGlobalMute = false; break; } }
//-------------------------------------------------------------- void ofApp::draw(){ ofClear(0,0); if (doDrawCamBackground.get()) drawSource(); if (!toggleGuiDraw) { ofHideCursor(); drawComposite(); } else { ofShowCursor(); switch(drawMode.get()) { case DRAW_COMPOSITE: drawComposite(); break; case DRAW_PARTICLES: drawParticles(); break; case DRAW_FLUID_FIELDS: drawFluidFields(); break; case DRAW_FLUID_DENSITY: drawFluidDensity(); break; case DRAW_FLUID_VELOCITY: drawFluidVelocity(); break; case DRAW_FLUID_PRESSURE: drawFluidPressure(); break; case DRAW_FLUID_TEMPERATURE: drawFluidTemperature(); break; case DRAW_FLUID_DIVERGENCE: drawFluidDivergence(); break; case DRAW_FLUID_VORTICITY: drawFluidVorticity(); break; case DRAW_FLUID_BUOYANCY: drawFluidBuoyance(); break; case DRAW_FLUID_OBSTACLE: drawFluidObstacle(); break; case DRAW_FLOW_MASK: drawMask(); break; case DRAW_OPTICAL_FLOW: drawOpticalFlow(); break; case DRAW_SOURCE: drawSource(); break; case DRAW_MOUSE: drawMouseForces(); break; case DRAW_VELDOTS: drawVelocityDots(); break; } drawGui(); } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key) { if( key == 'f' ) { //gotta toggle full screen for it to be right ofToggleFullscreen(); } if(key == 's'){ oculusRift.reloadShader(); } if(key == 'l'){ oculusRift.lockView = !oculusRift.lockView; } if(key == 'o'){ showOverlay = !showOverlay; } if(key == 'r'){ oculusRift.reset(); } if(key == 'h'){ ofHideCursor(); } if(key == 'H'){ ofShowCursor(); } if(key == 'p'){ predictive = !predictive; oculusRift.setUsePredictedOrientation(predictive); } }
void testApp::keyPressed(int key){ switch(key) { case 'f': ofToggleFullscreen(); break; case 'm': { static bool showCursor = true; showCursor ^= true; if(showCursor) ofShowCursor(); else ofHideCursor(); } break; case 't': MSA::ofxCocoa::setTransparent(!MSA::ofxCocoa::getTransparent()); break; case 'd': doDisplayLink ^= true; MSA::ofxCocoa::setSyncToDisplayLink(doDisplayLink); break; case 'v': doVSync ^= true; ofSetVerticalSync(doVSync); break; } }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ switch (key){ case 's': if (show_fps == true){ show_fps = false; } else{ show_fps = true; } break; case 'f': ofToggleFullscreen(); break; case 'k': bKaleidoscope = !bKaleidoscope; break; case '2': if(bKaleidoscope == true){ KaleidoscopeSlices+=2; if (KaleidoscopeSlices >= 100) KaleidoscopeSlices = 100; } break; case '1': if(bKaleidoscope == true){ KaleidoscopeSlices-=2; if (KaleidoscopeSlices < 2) KaleidoscopeSlices = 2; } break; case OF_KEY_UP: nFrag++; if (nFrag >= frags.size()) nFrag = 0; cout << endl << "--------" << endl << " Loading Frag: "<< nFrag+1 << endl << "--------" << endl; setCode(frags[nFrag]); break; case OF_KEY_DOWN: nFrag--; if (nFrag < 0) nFrag = frags.size()-1; cout << endl << "--------" << endl << " Loading Frag: "<< nFrag+1 << endl << "--------" << endl; setCode(frags[nFrag]); break; case 'r': resolPantalla++; if (resolPantalla == 3) resolPantalla = 4; if (resolPantalla > 4) resolPantalla = 1; cout << resolPantalla << endl; pingPong.allocate( resolHoriz/resolPantalla, resolVert/resolPantalla, GL_RGB); pingPong.swap(); break; case 'h': if (bHideCursor == true){ bHideCursor = false; ofShowCursor(); } else{ bHideCursor = true; ofHideCursor(); } break; } }
//-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ vs.mouseMoved(x, y-displaySystemYOffset); if(x < ds.width && y < ds.height) ofHideCursor(); else ofShowCursor(); }
///-------------------------------------------------------------- void ofApp::update() { #ifdef OF_DEBUG ofShowCursor(); currentScene = sceneManager.getCurrentSceneIndex(); #endif }
//-------------------------------------------------------------- void Global::resetGraphics() { ofSetupGraphicDefaults(); ofSetBackgroundAuto(true); ofSetVerticalSync(true); ofBackground(100, 100, 100); ofSetFrameRate(60); ofShowCursor(); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if(key==' ') { gui.toggleDraw(); } if(key == 'd') { debug = !debug; } else if(key == 'g') { show_gui = !show_gui; } else if(key == 'w') { #ifdef USE_FLOCK_GUI flock_gui.save(ofToDataPath("gui.bin", true)); #endif #ifdef USE_LIGHT_RAYS rays_gui.save(ofToDataPath("rays.bin",true)); #endif ia_gui.save(ofToDataPath("ia.bin",true)); bloom_gui.save(ofToDataPath("bloom.bin",true)); } else if(key == 's') { must_take_screenshot = true; } else if(key == 'l') { #ifdef USE_FLOCK_GUI flock_gui.load(ofToDataPath("gui.bin",true)); #endif #ifdef USE_LIGHT_RAYS rays_gui.load(ofToDataPath("rays.bin",true)); #endif ia_gui.load(ofToDataPath("ia.bin",true)); bloom_gui.load(ofToDataPath("bloom.bin",true)); } else if(key == 'f') { ofToggleFullscreen(); } else if(key == 'r') { settings.rotate_scene = !settings.rotate_scene; } else if(key == 't') { printf("Width: %d Height: %d\n", ofGetWidth(), ofGetHeight()); } else if(key == 'm') { show_mouse = !show_mouse; if(!show_mouse) { ofHideCursor(); } else { ofShowCursor(); } } else if(key == 'i') { show_fps = !show_fps; } }
//-------------------------------------------------------------- void ofApp::keyReleased(int key){ switch(key){ case ' ': gui.isHidden = !gui.isHidden; if(gui.isHidden) ds.enterLiveMode(); else ds.enterTestMode(); break; case 'm': ofShowCursor(); break; case 'f': isFullScreen = ! isFullScreen; ofSetFullscreen(isFullScreen); break; case 'l': gui.ledsOn = !gui.ledsOn; break; case 's': gui.strips = !gui.strips; break; case OF_KEY_UP: vs.angleKinectUp(); break; case OF_KEY_DOWN: vs.angleKinectDown(); break; case '0': vs.showQuote(0); break; case '1': vs.showQuote(1); break; case '2': vs.showQuote(2); break; case '3': vs.showQuote(3); break; case '4': vs.showQuote(4); break; case '5': vs.showQuote(5); break; case '6': vs.showQuote(6); break; case '7': vs.showQuote(7); break; case '8': vs.showQuote(8); break; } }
//-------------------------------------------------------------- void testApp::keyPressed(int key) { // dismiss safety warning on any key oculusRift.dismissSafetyWarning(); if( key == 'f' ) { //gotta toggle full screen for it to be right ofToggleFullscreen(); } if(key == 'a'){ cout << "FPS " << ofGetFrameRate() << " TARGET " << ofGetTargetFrameRate() << endl; } if(key == 's'){ oculusRift.reloadShader(); } if(key == 'v'){ oculusRift.setVignette( !oculusRift.getVignette() ); } if(key == 'l'){ oculusRift.lockView = !oculusRift.lockView; } if(key == 'o'){ showOverlay = !showOverlay; } if(key == 'r'){ oculusRift.reset(); } if(key == 'c'){ oculusRift.recenterPose(); } if(key == 'z'){ setupBoxes(); } if(key == 'h'){ ofHideCursor(); } if(key == 'H'){ ofShowCursor(); } if(key == 'd'){ oculusRift.setPixelDensity( oculusRift.getPixelDensity()-0.1 ); } if(key == 'D'){ oculusRift.setPixelDensity( oculusRift.getPixelDensity()+0.1 ); } if(key == 'p'){ oculusRift.setPositionTracking( !oculusRift.getPositionTracking() ); } }
bool DebugUI::toggleCursor(){ bShowCursor = !bShowCursor; if(bShowCursor){ ofShowCursor(); } else { ofHideCursor(); } return bShowCursor; }
//-------------------------------------------------------------- void testApp::update(){ // HIDE CURSOR OPTIONS if(Fullscreen){ ofHideCursor(); }else{ ofShowCursor(); } }
//-------------------------------------------------------------- void testApp::keyPressed (int key){ //no more draw hack... // clearBack = !clearBack; // // ofSetBackgroundAuto(clearBack); switch (key){ case '1':{ currentScene->kill(); currentScene = &spring; currentScene->init(); break; } case '2':{ currentScene->kill(); currentScene = &summer; currentScene->init(); break; } case '3':{ currentScene->kill(); currentScene = &autumn; currentScene->init(); break; } case '4':{ currentScene->kill(); currentScene = &winter; currentScene->init(); break; } case 'f':{ ofToggleFullscreen(); break; } case 'h':{ gui.toggleView(); break; } case 'm':{ if(bShowMouse){ ofHideCursor(); bShowMouse = false; }else { ofShowCursor(); bShowMouse = true; } break; } default: { break; } } }
void testApp::updateGraphics() { if(debug || edit) ofShowCursor(); else ofHideCursor(); cam->update(); part->setVectors(cam->getAmplitudeWithinRegion()); part->update(); // Draw particle system cont.begin(); ofClear(0); // ofBackground(0,100); part->draw(); cont.end(); // Make mask mask.begin(); ofClear(0); for(int i=0;i<N_PROJECTOR;i++) { ofPushMatrix(); // ofEnableAlphaBlending(); ofTranslate(i*pw, 0); // for(int j=N_LAYER;j>0;j--) { //ofSetColor(255,255,255,j/N_LAYER * 255); pview[i]->getLayer(0)->draw(0,0); // } ofPopMatrix(); } mask.end(); // Bind the textures cont.getTextureReference().bind(); mask.getTextureReference().bind(); fbo.begin(); alpha.begin(); alpha.setUniformTexture("tex0",cont,cont.getTextureReference().getTextureData().textureID); alpha.setUniformTexture("tex1",mask,mask.getTextureReference().getTextureData().textureID); int fWidth = fbo.getWidth(); int fHeight = fbo.getHeight(); // Draw to a quad glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(0, 0, 0); glTexCoord2f(fWidth, 0); glVertex3f(fWidth, 0, 0); glTexCoord2f(fWidth, fHeight); glVertex3f(fWidth, fHeight, 0); glTexCoord2f(0, fHeight); glVertex3f(0, fHeight, 0); glEnd(); alpha.end(); fbo.end(); mask.getTextureReference().unbind(); cont.getTextureReference().unbind(); }
//-------------------------------------------------------------- void testApp::update(){ globalSnd.update(); if( state >= APP_RUN_NORMALLY ){ if( cam.percentOver >= 0.98 ){ showMouseTillTime = ofGetElapsedTimef() + 1.0; } if( ofGetElapsedTimef() < showMouseTillTime ){ ofShowCursor(); }else{ ofHideCursor(); } } if( ofGetFrameNum() > 5 ){ if( state == APP_LOAD_SOUNDS ){ loadSoundFx(); state = APP_SETUP_RISEFALL; launchState = "Loading Rise Fall"; }else if( state == APP_SETUP_RISEFALL ){ splash.setButtonVisible(); cam.loadResources(); state = APP_WAITING_LAUNCH; launchState = "Waiting for launch"; }else if( state == APP_LOAD_CAMERA ){ if( grabber.initGrabber(320, 240, true) ){ launchState = "camera launched - loading ferns"; tracker.setup("tracking/front/model.bmp", "tracking/back/model.bmp", grabber.width, grabber.height); launchState = "camera launched - ferns loaded"; bCapture = true; state = APP_RUN_NORMALLY; //we do this to give the window time to go fullscreen targetWaitFrame = ofGetFrameNum() + 10; ofSetFullscreen(true); }else{ state = APP_WAITING_LAUNCH; launchState = "Load camera failed - check it is not in use by another application!"; splash.setButtonVisible(); } }else if( state == APP_RUN_NORMALLY ){ if( !bSetup && ofGetFrameNum() > targetWaitFrame ){ cam.setup(); bSetup = true; }else{ updateCapture(); cam.update(); } } } }
void ofApp::keyPressed(int key) { if (key == 'm' || key == 'M' ) { multitouch = !multitouch; if (multitouch) { ofLogNotice() << "multitouch on" ; ofHideCursor(); } else { ofLogNotice() << "multitouch off" ; ofShowCursor(); } } }
//-------------------------------------------------------------- void ofApp::setup(){ // // // string hostname = ofxNet::NetworkUtils::getNodeName(); #ifdef _DEBUG printf("hostname: %s\n", hostname.c_str()); #endif // // // ofSetBackgroundAuto(false); ofEnableAntiAliasing(); ofSetCircleResolution( 24 ); //m_default_font.loadFont("fonts/verdana.ttf",false,0.3, 144.0); m_default_font.setup("fonts/verdana.ttf"); m_buttons[0].loadImage("ui/PhotoCollection.png"); m_buttons[1].loadImage("ui/BusinessModel.png"); m_buttons[2].loadImage("ui/Save.png"); m_buttons[3].loadImage("ui/Close.png"); ofDisableArbTex(); m_background_tile.loadImage("ui/background_tile.png"); m_background_tile.getTextureReference().setTextureWrap(GL_REPEAT, GL_REPEAT); ofEnableArbTex(); layout(); // // // m_db.setup(); vector< openTableDocument* > sessions = m_db.getDocumentsOfType("session"); if (sessions.size() > 0 ) { m_current_session = ( openTableSession* ) sessions[ 0 ]; } else { m_current_session = ( openTableSession* ) m_db.add("session"); m_db.save(); } // // start server // m_server.setup(); // // // m_show_keyboard = false; if ( !m_multitouch.setup() ) { ofShowCursor(); } }
//-------------------------------------------------------------- void ofApp::draw(){ if(drawGui || mouseMode) ofShowCursor(); else ofHideCursor(); ofEnableAntiAliasing(); ofBackground(0); ofEnableBlendMode(OF_BLENDMODE_ADD); // draw rays for(auto& ray: rays){ if(!ray.isDead()){ ray.draw(); } } // draw prism prism->draw(); // draw the fingers for (auto& f : finger){ f.draw(); } // draw spread display ofPushStyle(); ofPushMatrix(); ofTranslate(0, 500); ofSetLineWidth(2); spreadCircle.draw(ofGetWidth()/2 - spreadCircle.getWidth()/2, 50); ofVec2f v(-1, 0); v.rotate(spread/2.0 * 180); v.normalize(); ofPoint c(ofGetWidth()/2, 89.25); ofSetColor(255); ofDrawLine(c + 10 * v, c + v * 45); ofRectangle bounds = tstar.getStringBoundingBox(ofToString(spread.get(), 1), 0, 0); tstar.drawString(ofToString(spread.get(), 1), (c + v * 60).x - (bounds.getWidth()/2.0), (c + v * 60).y + (bounds.getHeight()/2.0)); ofPopMatrix(); ofPopStyle(); syphonMainOut.publishScreen(); // draw debug stuff if(drawGui){ gui.draw(); ofSetColor(255); ofDrawBitmapString(ofGetFrameRate(), 5, ofGetHeight() - 25); ofDrawBitmapString(rays.size(), 5, ofGetHeight()-10); } }
//-------------------------------------------------------------- void testApp::keyPressed (int key){ if (key == 'p'){ // print // See outputPostscript() bEpsCapture = true; } else if (key == 'f'){ // fullscreen bFullscreen = !bFullscreen; ofSetFullscreen (bFullscreen); } else if (key == 'h'){ // help bShowControlPanel = !bShowControlPanel; if (bShowControlPanel){ gui.show(); ofShowCursor(); } else { gui.hide(); ofShowCursor(); } } }
void ofxMouseAutoHider::update(ofEventArgs &evt) { float timeSinceLastMouse = ofGetElapsedTimef() - lastTimeMouseMoved; // printf("time since last mouse moved: %f\n", timeSinceLastMouse); if(cursorShowing && timeSinceLastMouse>timeout) { cursorShowing = false; ofHideCursor(); } if(!cursorShowing && timeSinceLastMouse<timeout) { cursorShowing = true; ofShowCursor(); } }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if(key=='f'){ ofToggleFullscreen(); } if(key=='h'){ hideGui=!hideGui; if(hideGui){ ofHideCursor(); }else{ ofShowCursor(); } } }
void ofxRGBDCaptureGui::keyPressed(ofKeyEventArgs& args){ int key = args.key; if(key == ' '){ if(currentTab == TabCalibrate){ captureCalibrationImage(); } else if(currentTab == TabRecord){ toggleRecord(); } else if(currentTab == TabPlayback){ timeline.togglePlay(); } } if(key == OF_KEY_DEL && currentTab == TabCalibrate){ alignment.discardCurrentPair(); alignment.saveState(); } if(key == 'f'){ ofToggleFullscreen(); } if(key == 'p'){ fullscreenPoints = !fullscreenPoints; if(fullscreenPoints){ for(int i = 0; i < buttonSet.size(); i++){ buttonSet[i]->disableAppEvents(); buttonSet[i]->disableMouseEvents(); } for(int i = 0; i < btnTakes.size(); i++){ btnTakes[i].button->disableAppEvents(); btnTakes[i].button->disableMouseEvents(); } ofHideCursor(); } else{ for(int i = 0; i < buttonSet.size(); i++){ buttonSet[i]->enableMouseEvents(); buttonSet[i]->enableAppEvents(); } for(int i = 0; i < btnTakes.size(); i++){ btnTakes[i].button->enableMouseEvents(); btnTakes[i].button->enableAppEvents(); } ofShowCursor(); } } }