// testing helper to color gui void setPanelColor(ofxPanel& panel, ofColor bright){ ofColor mid(bright); ofColor dark(bright); mid.setBrightness(100); dark.setBrightness(30); panel.setDefaultHeaderBackgroundColor(bright); panel.setDefaultFillColor(mid); panel.setDefaultBackgroundColor(dark); }
Gui(App *a, OscAdapter *o){ app = a; osc = o; gui.setup(); setasPanel.setup(); setasPanel.setPosition(10, 250); init(); bVisible = true; load(); }
void keyPressed(int key) { if( key == 'h' ){ bHide = !bHide; } if(key == 's') { gui.saveToFile("settings.xml"); } if(key == 'l') { gui.loadFromFile("settings.xml"); } if(key == ' '){ color = ofColor(255); } }
void setup(string name) { gui.setup(name); gui.add(nwLength.set("NW Length", defaultLength, minLength, maxLength)); gui.add(nwSpeed.set("NW Speed", 0, -maxSpeed, maxSpeed)); gui.add(neLength.set("NE Length", defaultLength, minLength, maxLength)); gui.add(neSpeed.set("NE Speed", 0, -maxSpeed, maxSpeed)); gui.add(seLength.set("SE Length", defaultLength, minLength, maxLength)); gui.add(seSpeed.set("SE Speed", 0, -maxSpeed, maxSpeed)); gui.add(swLength.set("SW Length", defaultLength, minLength, maxLength)); gui.add(swSpeed.set("SW Speed", 0, -maxSpeed, maxSpeed)); }
void draw(){ wc.begin(); if(!switchVideo){ wc.setUniformTexture("colorMap", img.getTexture(), 1); wc.setUniformTexture("heightMap",gray.getTexture(), 2); } else{ wc.setUniformTexture("colorMap", player.getTexture(), 1); fboDepth.begin(); player.draw(0,0); fboDepth.end(); wc.setUniformTexture("heightMap",fboDepth.getDepthTexture(),2); } wc.setUniform1f("time", ofGetElapsedTimef()*time); wc.setUniform1f("gradientStep", stepGradient); wc.setUniform1f("advectStep", advectStep); wc.setUniform1f("flipHeightMap",flipHeightMap); wc.setUniform4f("advectMatrix",advectMatrix->w,advectMatrix->x,advectMatrix->y,advectMatrix->z); fbo.draw(0,0); wc.end(); img.draw(0,0,img.getWidth()/4,img.getHeight()/4); player.draw(img.getWidth()/4,0,img.getWidth()/4,img.getHeight()/4); gui.draw(); }
void setup(){ ofSetVerticalSync(false); w=ofGetScreenWidth(); h=ofGetScreenHeight(); ofDisableArbTex(); img.load("1.jpg"); player.load("1.mp4"); player.play(); player.setLoopState(OF_LOOP_NORMAL); gray = img; gray.setImageType(OF_IMAGE_GRAYSCALE); wc.load("wcolor.vert","wcolor.frag"); ofFbo::Settings s; s.depthStencilAsTexture=true; s.useDepth=true; s.width=w; s.height=h; fboDepth.allocate(s); fbo.allocate(w,h); fbo.begin(); ofClear(0,0,100,255); fbo.end(); gui.setup(); gui.add(stepGradient.set("step gradient", .0015, -1., 1.)); gui.add(advectStep.set("step advect", .0015, -.1, .1)); gui.add(flipHeightMap.set("flip height map", 0.7, 0., 2.)); gui.add(time.set("time", 0., 0., 1.)); gui.add(advectMatrix.set("advect matrix", ofVec4f(0.1), ofVec4f(-1.), ofVec4f(1.))); gui.add(switchVideo.set("switch video", false)); }
void draw(){ name = app->metadata.name; exercice = app->metadata.exercice; string stamp = app->session->timestamp.substr(0, stamp.size()-7); timestamp = day(stamp); counter = ofToString(app->session->getSize()); index = ofToString(app->session->index); app->heatmap.L = trace; app->session->speed = playback_speed; if(bVisible){ gui.draw(); if(app->metadata.exercice == "Setas"){ setasPanel.draw(); current = ofToString(app->reactions.n_hits) + "/" + ofToString(Assets::getInstance()->maxItems(app->metadata.variation)); time = ofToString(app->ellapsedTime, 1) + "/" + ofToString(Assets::getInstance()->maxTime(app->metadata.variation)) ; code = ofToString(Assets::getInstance()->exerciceCode(app->metadata.variation)) ; setasLife = ofToString(Assets::getInstance()->maxLife(app->metadata.variation)) ; } } }
void setup() { ofBackground(255); ofSetFrameRate(60); config.load("config.xml"); defaultLength = config.getFloatValue("cable/length/default"); minLength = config.getFloatValue("cable/length/min"); maxLength = config.getFloatValue("cable/length/max"); host = config.getValue("osc/host"); sendPort = config.getIntValue("osc/sendPort"); receivePort = config.getIntValue("osc/receive"); oscSend.setup(host, sendPort); oscReceive.setup(receivePort); local.setup("Local"); remote.setup("Remote"); zeros.setup("Zeros"); zeros.add(nwZero.setup("NW Zero")); zeros.add(neZero.setup("NE Zero")); zeros.add(seZero.setup("SE Zero")); zeros.add(swZero.setup("SW Zero")); nwZero.addListener(this, &ofApp::zeroNW); neZero.addListener(this, &ofApp::zeroNE); seZero.addListener(this, &ofApp::zeroSE); swZero.addListener(this, &ofApp::zeroSW); local.gui.loadFromFile("settings.xml"); local.gui.setPosition(10, 10); zeros.setPosition(10, 200); remote.gui.setPosition(10, 310); }
// --------------------------------------------------------------------------------------- // void draw() { ofSetColor( ofColor::white ); ofDisableAlphaBlending(); destImage.draw( 0, 0, ofGetWidth(), ofGetHeight() ); if( drawGui ) { gui.draw(); } drawStringShadowed( fontSmall, "Method " + methodNames.at(methodIndex), 5, ofGetHeight() - 25 ); drawStringShadowed( fontSmall, "Scale " + ofToString( Scale * ScaleMultiplier ), 5, ofGetHeight() - 5 ); drawStringShadowed( fontSmall, ofToString( ofGetFrameRate(), 2), ofGetWidth() - 30, ofGetHeight() - 5); }
void setup() { ofSetVerticalSync(true); ofSetWindowShape(1024, 768); // we add this listener before setting up so the initial circle resolution is correct circleResolution.addListener(this, &ofApp::circleResolutionChanged); ringButton.addListener(this,&ofApp::ringButtonPressed); gui.setup(); // most of the time you don't need a name gui.add(filled.setup("fill", true)); gui.add(radius.setup( "radius", 140, 10, 300 )); gui.add(center.setup("center",ofVec2f(ofGetWidth()*.5,ofGetHeight()*.5),ofVec2f(0,0),ofVec2f(ofGetWidth(),ofGetHeight()))); gui.add(color.setup("color",ofColor(100,100,140),ofColor(0,0),ofColor(255,255))); gui.add(circleResolution.setup("circle res", 5, 3, 90)); gui.add(twoCircles.setup("two circles")); gui.add(ringButton.setup("ring")); gui.add(screenSize.setup("screen size", "")); bHide = true; ring.loadSound("ring.wav"); }
void draw() { ofBackground(25); fbo.begin(); ofClear(0,0,0,0); ofEnableDepthTest(); camera.begin(); glPushMatrix(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0); if(dvel) draw_velocity(); if(dden){ draw_density(); } glDisable(GL_BLEND); glDisable(GL_ALPHA_TEST); glPopMatrix(); if( drawAxis ){ ofDrawAxis(15); } camera.end(); ofDisableDepthTest(); fbo.end(); shader.begin(); shader.setUniformTexture("tex",fbo.getTextureReference(),0); shader.setUniform2f("resolution",dw,dh); shader.setUniform1f("timer",ofGetElapsedTimef()); fbo.draw(0,0); shader.end(); gui.draw(); }
void draw() { ofBackgroundGradient(ofColor::white, ofColor::gray); if( filled ){ ofFill(); }else{ ofNoFill(); } ofSetColor(color); if(twoCircles){ ofCircle(center->x-radius*.5, center->y, radius ); ofCircle(center->x+radius*.5, center->y, radius ); }else{ ofCircle((ofVec2f)center, radius ); } // auto draw? // should the gui control hiding? if( bHide ){ gui.draw(); } }
void load(){ string path = ofToDataPath("gui.xml"); ofLogNotice() << "Loading gui from: " << path; gui.loadFromFile(path); }
void draw() { local.gui.draw(); remote.gui.draw(); zeros.draw(); }
// --------------------------------------------------------------------------------------- // void setup() { ofSetFrameRate(60); ofSetVerticalSync(true); ofBackground(0); ofxCL::Context::listDevices(); ocl.setup( 0, true ); noiseProgram.load("NoiseKernel.cl"); methodNames.push_back( "GradientNoiseImage2d" ); methodNames.push_back( "RidgedMultiFractalImage2d" ); methodNames.push_back( "MonoFractalImage2d" ); methodNames.push_back( "TurbulenceImage2d" ); Resolution.addListener(this, &ofApp::resolutionChanged); gui.setup("Settings", "Settings.xml"); gui.add( methodIndex.set( "methodIndex", 3, 0, methodNames.size()-1 ) ); gui.add( Resolution.set( "Resolution", 1024, 2, 4096 ) ); gui.add( Scale.set( "Scale", 1.0, 0.0, 1.0 ) ); gui.add( ScaleMultiplier.set( "Scale Multiplier", 3.0, 0.001, 100.0f ) ); gui.add( Lacunarity.set( "Lacunarity", 2.02f, 0.001f, 10.0f ) ); gui.add( Increment.set( "Increment", 1.0f, -1.0, 1.0f ) ); gui.add( Octaves.set( "Octaves", 3.3f, 0.001, 20.0f ) ); gui.add( Amplitude.set( "Amplitude", 1.0f, 0.001, 10.0f ) ); gui.add( AutoMove.set( "AutoMove", true ) ); gui.add( AutoMoveMagnitude.set( "AutoMoveMagnitude", 0.5f, 0.001, 10.0f ) ); drawGui = true; fontSmall.loadFont("DIN.otf", 8 ); }
void save(){ string path = ofToDataPath("gui.xml"); ofLogNotice() << "Saving gui to: " << path; gui.saveToFile(path); }
//-------------------------------------------------------------- void init(){ gui.add(name.setup("Paciente", name)); gui.add(exercice.setup("Ejercicio", exercice)); gui.add(timestamp.setup("Fecha", timestamp)); gui.add(counter.setup("Frames", counter)); trace = 400; if(Assets::getInstance()->isViewer()){ gui.add(index.setup("Posicion", index)); gui.add(playback_speed.setup( "speed", 2, 1, 20)); gui.add(trace.setup( "trace", 400, 100, 5000 )); } else{ gui.add(calibrate.setup("Calibrar")); gui.add(clear.setup("Limpiar")); calibrate.addListener(this,&Gui::calibratedPressed); clear.addListener(this,&Gui::clearPressed); setasPanel.add(current.setup("Frutas", "")); setasPanel.add(time.setup("Tiempo", "")); setasPanel.add(setasLife.setup( "Maxima vida frutas", "")); setasPanel.add(code.setup("Code", "")); } }
void setup() { ofSetFrameRate(60); ofSetVerticalSync(true); dw=ofGetScreenWidth(); dh=ofGetScreenHeight(); ofDisableArbTex(); fbo.allocate(dw,dh); shader.load("shaders/fluid.vert","shaders/fluid.frag"); camera.setFarClip(100000); camera.setNearClip(.1); if ( !allocate_data () ){ cout<<"error allocate!"<<endl; exit(); } clear_data (); gui.setup(); gui.setPosition(ofPoint(10,10)); gui.add(size_cube.setup("size box", 100.0f,0.0f,255.0f)); gui.add(dvel.setup("draw velocity", true)); gui.add(dden.setup("draw density", false)); gui.add(TaddSource.setup("add source",false)); gui.add(Bclear.setup("clear source",false)); gui.add(addX.setup("add x",false)); gui.add(addY.setup("add y",false)); gui.add(addZ.setup("add z",false)); gui.add(dt.setup("time delta", 0.9f,0.0f,25.0f)); gui.add(diff.setup("diffuse", 0.0f,0.0f,25.0f)); gui.add(visc.setup("viscosity", 0.0f,0.0f,25.0f)); gui.add(force.setup("add force",30.0f,0.0f,60.0f)); gui.add(source.setup("density", 200.0f,0.0f,600.0f)); gui.add(source_alpha.setup("alpha",0.05,0.0,1.0)); gui.add(drawAbstacle.setup("draw abstacle",false)); gui.add(drawAxis.setup("draw Axis",true)); gui.add(sourcePosX.setup("source posX", 0,-10,SIZE)); gui.add(sourcePosY.setup("source posY", 0,-10,SIZE)); gui.add(sourcePosZ.setup("source posZ", 0,-10,SIZE)); }