//-------------------------------------------------------------- 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; } }
//-------------------------------------------------------------- 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++; } }
//-------------------------------------------------------------- SETING void testApp::setup(){ ofEnableAlphaBlending(); ofEnableSmoothing(); ofSetVerticalSync(false); ofSetDataPathRoot("data/"); ofLog(OF_LOG_NOTICE, "Loading ofxComposer"); composer.load("config.xml"); ofLog(OF_LOG_NOTICE, "Loading xml data Settings"); data.load(); ofLog(OF_LOG_NOTICE, "Loading Kinect Drivers"); kinect.init(); kinect.setRegistration(true); kinect.open(); width = 640; height = 480; numPixels = width * height; ofLog(OF_LOG_NOTICE, "Allocating INPUT images"); blobImage.allocate(width,height); depthFloatImage.allocate(width, height,OF_IMAGE_GRAYSCALE); ofLog(OF_LOG_NOTICE, "Starting Atmosphere"); atmosphere.linkData(&data); atmosphere.allocate(width,height, data.atmosphereResolution ); ofLog(OF_LOG_NOTICE, "Starting Geosphere"); geosphere.linkData(&data); geosphere.allocate(width,height); ofLog(OF_LOG_NOTICE, "Starting Hydrosphere"); hydrosphere.linkData(&data); hydrosphere.allocate(width,height); ofLog(OF_LOG_NOTICE, "Starting Biosphere"); biosphere.linkData(&data); biosphere.allocate(width,height); biosphere.flock.linkData(&data); ofLog(OF_LOG_NOTICE, "Starting multi-texturing mapping"); textures.linkData(&data); textures.allocate(width*2, height*2); light.setPosition(ofVec3f(0,800,-100)); //light.setDiffuseColor(ofColor(192, 160, 128)); cam.setDistance(3000); bEdit = false; bTerrain = false; bCalibrated = true; bMouse = false; ofHideCursor(); ofSetFullscreen(true); composer.setEdit(false); }
//-------------------------------------------------------------- void testApp::setup() { ///------------------------------ /// DON'T CHANGE THESE ///------------------------------ ofSetFrameRate(60); ofSetVerticalSync(true); ofEnableAlphaBlending(); ofHideCursor(); ///------------------------------ /// YOU CAN CHANGE THESE ///------------------------------ currentScreen = &menuScreen; LOAD_WITH_SOUND = true; ///------------------------------ /// DON'T CHANGE THESE ///------------------------------ if (!LOAD_WITH_SOUND) { menuScreen.LOAD_WITH_SOUND = false; gameScreen.LOAD_WITH_SOUND = false; } else { menuScreen.LOAD_WITH_SOUND = true; gameScreen.LOAD_WITH_SOUND = true; } setupAllScreens(); }
//-------------------------------------------------------------- void testApp::setup(){ screen.allocate(ofGetWidth(), ofGetHeight(), GL_RGBA); screen.begin(); ofClear(1,1,1,1); screen.end(); girlimage.loadImage("girl25.jpeg"); int w = girlimage.getWidth(); int h = girlimage.getHeight(); dnared.setup(w); dnagreen.setup(w); dnablue.setup(w); y = 0; dnamutatefactor = ofRandom(0.001, 0.05); readimg = true; ofSetBackgroundAuto(false); ofBackground(255); ofSetFrameRate(60); ofEnableAlphaBlending(); buffersize = 1024; samplerate = 44100; audio.assign(buffersize, 0.0); soundStream.setup(this, 2, 0, samplerate, buffersize, 4); volume = 0.5; ofHideCursor(); }
void ofApp::setup() { ofSetLogLevel(OF_LOG_VERBOSE); consoleListener.setup(this); ofHideCursor(); string videoPath = ofToDataPath("../../../video/Timecoded_Big_bunny_1.mov", true); settings.videoPath = videoPath; settings.useHDMIForAudio = true; //default true settings.enableLooping = true; //default true settings.enableTexture = false; //default true omxPlayer.setup(settings); int step=200; for(int i=0; i<omxPlayer.getWidth(); i+=step) { for(int j=0; j<omxPlayer.getHeight(); j+=step) { ofRectangle grid(i, j, step, step); grids.push_back(grid); } } }
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; } }
//-------------------------------------------------------------- // 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 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 testApp::setup() { //ofSetLogLevel(OF_LOG_VERBOSE); // string videoPath = ofToDataPath("../../../video/Timecoded_Big_bunny_1.mov", true); string videoPath = ofToDataPath("../../../video/PEEK.mov", true); //Somewhat like ofFboSettings we may have a lot of options so this is the current model ofxOMXPlayerSettings settings; settings.videoPath = videoPath; settings.useHDMIForAudio = false; //default true settings.enableTexture = true; //default true settings.enableLooping = true; //default true settings.enableAudio = true; //default true, save resources by disabling settings.doFlipTexture = true; //default false //so either pass in the settings omxPlayer.setup(settings); // listen on the given port cout << "listening for osc messages on port " << PORT << "\n"; receiver.setup(PORT); ofHideCursor(); //ofSetVerticalSync(true); //just trying framerate //ofSetFrameRate(60); }
//-------------------------------------------------------------- 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 testApp::draw(){ if (fullscreen) { ofHideCursor(); } // Display the movie movies[index].draw(movieX,movieY,movieWidth,movieHeight); }
//-------------------------------------------------------------- void karmaMedusaePlayer::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); ofHideCursor(); // create the medusae medusae = new karmaMedusae(); // load movies moviesFolder.listDir("videos/"); if( moviesFolder.size() ){ scannedMovies.resize(moviesFolder.size()); currentMovie = (int)( ofRandom(0, moviesFolder.size() )); player.setPixelFormat(OF_PIXELS_RGB); player.loadMovie( moviesFolder.getPath( currentMovie ) ); // loads first video in memory updateMovieDimensions( player.getWidth(), player.getHeight() ); player.play(); player.setVolume(0); player.setLoopState(OF_LOOP_NONE); cout << "Starting with video #" << currentMovie << "/" << moviesFolder.size() << endl; } }
void PMSc6Kinect_Detect::setup() { #if ENABLE_KINECT PMMotionExtractor::getInstance().start(); ofHideCursor(); #endif }
//-------------------------------------------------------------- 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::keyReleased(int key){ if (bMouse){ ofShowCursor(); } else { ofHideCursor(); } }
//-------------------------------------------------------------- void testApp::setup(){ ofBackground(255); ofSetVerticalSync(true); ofSetFrameRate(60); ofEnableAlphaBlending(); ofEnableSmoothing(); ofHideCursor(); int basisColor = ofRandom(255); int colors = 2; creatures.clear(); // creature a bunch of creatures for (int i = 0; i < 5; i++) { creature c; float size; // make a few bigger guys and then a bunch of smaller cuties // if (i < 3) // size = ofRandom(75, 100); // else size = ofRandom(25, 30); // give them random fun, bright, semi-transparent colors // with the infamous Matt Felsen triadic color palette algorithm float hue = fmod(basisColor + i%colors * (255/colors) + ofRandom(20), 255); ofColor col = ofColor::fromHsb(hue, 200, 200, 200); c.setup(col, size); creatures.push_back(c); } }
//-------------------------------------------------------------- void ofChanelApp::setup() { ofBackground(0); ofSetVerticalSync(true); //Leap Motion _LeapController.addListener(_LeapListener); //Theatre _Theatre.setup(); ofAddListener(_Theatre._TheatreEvent, this, &ofChanelApp::onChanelTheatreEvent); //Cursor setupCursor(); //Timer _fMainTimer = ofGetElapsedTimef(); _IdleTimer = -1; //BGM setupBGM(); _useLeap = true; _showMouse = true; #ifndef _DEBUG ofToggleFullscreen(); ofHideCursor(); _showMouse = false; #endif//_DEBUG }
//-------------------------------------------------------------- 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 testApp::setup(){ debug = false; left = false; right = false; r = 255; g = 255; b = 255; ofSetWindowTitle("CLOUD BETA"); ofHideCursor(); ofBackground(r,g,b); ofSetFrameRate(FRAMERATE); h = false; title = "Welcome to CLOUD BETA!\n"; colors = "Speed and behavior of particles has influence on the color gradient.\n"; keys = "Use number keys 0-9 to reset each particle's speed.\n"; mouse = "Holding left click causes attraction.\nRight click causes repulsion.\nBoth together casts a calm spell.\n"; esc = "Hit 'r' to reset. Hit 'Esc' to exit.\n"; help = "Hit 'h' to bring up info on controls.\n"; particles.assign(NUM_OF_PARTICLES,Particle()); for (int i=0; i<particles.size(); i++){ particles[i].getGraphic().fill(); } }
//-------------------------------------------------------------- void testApp::setup() { ofSetVerticalSync(true); ofBackgroundHex(0xfdefc2); ofSetLogLevel(OF_LOG_NOTICE); ofHideCursor(); loadSettings("settings.xml"); receiver.setup( port ); box2d.init(); box2d.setGravity(0, 20); box2d.createGround(); box2d.setFPS(30.0); box2d.registerGrabbing(); polyLine.addVertex(ofGetWidth(), 0); polyLine.addVertex(3529, 0); polyLine.addVertex(2469, ofGetHeight()); polyLine.addVertex(1269, ofGetHeight()); polyLine.addVertex(672, 702); polyLine.addVertex(672, 0); polyLine.addVertex(0, 0); // make the shape polyLine.setPhysics(0.0, 0.0, 0.3); polyLine.create(box2d.getWorld()); backgroundimg.loadImage("images/vimeoarcadeC.png"); }
void World::setup(){ ofHideCursor(); ofSetLogLevel(OF_LOG_VERBOSE); ofSetFrameRate(40); glEnable(GL_DEPTH_TEST); //lights glShadeModel(GL_SMOOTH); light.enable(); light.setPosition(10,50,-50); light.setAttenuation(1.f,0.1f,0.f); light2.setPosition(10,-27,88); light2.setAttenuation(0.5f,0.1f,0.f); light2.disable(); //ofEnableSeparateSpecularLight(); ////////////////Camera//////////////// ofBackground(0, 0, 0, 0); cam.setNearClip(0.1); cam.setFarClip(1000); //cam.setPosition(4,6,-16);//2,6,16 int x = (0.4 * GRID_COLS)/2; cam.setPosition(x,6,-8);//x,6,-13 if( GRID_COLS == 26 && GRID_ROWS==18 ) cam.setPosition(5,10,-13);//for 26x18 resolution use 5, 10, -13 cam.lookAt(ofVec3f(x,0,20)); ////////////////Camera//////////////// _rm = new MyResourceManager(); //serveix per controlar les posicions de les parets i obtenir els models #ifdef DEBUG_TOOLS _player = new Player(60,80, &_rm->getModelByName("cube"), ofVec3f( -10, 0, 0), "yellow"); #else _player = new Player(GRID_ROWS, GRID_COLS, &_rm->getModelByName("cube"), ofVec3f( 0, 0, 0), "blue"); #endif loadWallsFromXML(); _isKinectViewEnabled = false; _wallsCount = 0; _distanceOfWallFromPlayer = -1; _debugMessages = false; _lastRandomWallIndex = -1; _evenOdd = false; _startGame = false; _view = INSTRUCTIONS_VIEW; _lastView = _view; _barColor = ofColor (162,2,26); _timer = -1; _simulateEnd = false; #ifdef DEBUG_TOOLS _player->getUserMapRef()->getKinectControllerRef()->setTrackingMode(1); setTempoModulation("H-M-L"); _view = END_GAME_VIEW; _view = FIRST_PERSON_VIEW; #endif }
//-------------------------------------------------------------- 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(); }
SurfaceManagerGui::SurfaceManagerGui() { surfaceManager = NULL; guiMode = GuiMode::NONE; bDrag = false; registerMouseEvents(); ofHideCursor(); _cmdManager = 0; }
void testApp::setup() { ofSetVerticalSync(true); ofHideCursor(); //ofSetDataPathRoot("../../../../../SharedData/skull/"); ofSetLogLevel(OF_LOG_VERBOSE); camera.setup(); generate(); }
//-------------------------------------------------------------- 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 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() ); } }
//-------------------------------------------------------------- void ofApp::draw() { ofHideCursor(); ofSetColor(255,255,255); img.draw(x, y, img.width/2, img.height/2); rgbaFbo.draw(0,0); }
bool DebugUI::toggleCursor(){ bShowCursor = !bShowCursor; if(bShowCursor){ ofShowCursor(); } else { ofHideCursor(); } return bShowCursor; }