void testApp::setupGUI(){ ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); ofxControlPanel::setTextColor(simpleColor(240, 240, 240, 255)); int guiWidth = 800; int guiHeight = 800; gui.setup("Sync", 0, 0, guiWidth, guiHeight, true); // string controlPanelName, float panelX, float panelY, float width, float height, bool doSaveRestore gui.addPanel("Line", 3, false); // name, number of columns, locked gui.addPanel("Tracking", 3, false); // name, number of columns, locked gui.addPanel("App", 3, false); //just doing playback/recording on keyboard for now..... //--------- PANEL 0, Line Variables gui.setWhichPanel("Line"); gui.setWhichColumn(0); gui.addSlider("Length of History", "HISTORY_LENGTH", 100, 2, 200, true); gui.addToggle("Fade History?", "DO_HISTORY_FADE", 1); gui.addSlider("Line scale", "LINE_SCALE", 1.f, 1.f, 1000.f, false); gui.addSlider("Line width", "LINE_WIDTH", 1.f, 1.f, 20.f, false); gui.addSlider("Line alpha", "LINE_ALPHA", 128, 1, 255, true); //--------- PANEL 1, Tracking Variables gui.setWhichPanel("Tracking"); gui.setWhichColumn(0); skeletonDrawer.setTheOpenNI(theOpenNI); //gui.addDrawableRect("Video Image", &theOpenNI->getimageTextureReference(), 320, 240); gui.addCustomRect("Video and skeleton", &skeletonDrawer, 320, 240); gui.addDrawableRect("Depth Image", &theOpenNI->getDepthTextureReference(), 320, 240); gui.setWhichColumn(2); gui.addToggle("All points tracking?", "DISPLAY_ALL_POINTS", 1); gui.addToggle("Hip Line?", "HIP_LINE", 0); gui.addToggle("Shoulder Line?", "SHOULDER_LINE", 0); gui.addToggle("Hands Line", "HANDS_LINE", 0); gui.addToggle("Hip Line to edge?", "HIP_LINE_EDGE", 0); gui.addToggle("Shoulder Line to edge?", "SHOULDER_LINE_EDGE", 0); gui.addToggle("Hands Line to edge", "HANDS_LINE_EDGE", 0); gui.addToggle("All points: vertical lines", "DRAW_VERTICAL_LINES", 0); gui.addToggle("All points: horizontal lines", "DRAW_HORIZONTAL_LINES", 0); gui.addToggle("All points: circles", "DRAW_CIRCLES", 0); gui.addToggle("All points: ribbon ", "DRAW_RIBBON", 0); //--------- PANEL 2, App Variables gui.setWhichPanel("App"); gui.setWhichColumn(0); // gui.addToggle("Live?", "SHOULD_BE_LIVE", 1); // gui.addToggle("Record?", "SHOULD_BE_RECORDING", 0); //some dummy vars we will update to show the variable lister object elapsedTime = ofGetElapsedTimef(); appFrameCount = ofGetFrameNum(); appFrameRate = ofGetFrameRate(); vector <guiVariablePointer> vars; vars.push_back( guiVariablePointer("elapsed time", &elapsedTime, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("elapsed frames", &appFrameCount, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("app fps", &appFrameRate, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("mouse x", &mouseX, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("mouse y", &mouseY, GUI_VAR_INT) ); gui.addVariableLister("app vars", vars); gui.addChartPlotter("App FPS", guiStatVarPointer("app fps", &appFrameRate, GUI_VAR_FLOAT, true, 2), 200, 100, 200, 10, 50); //SETTINGS AND EVENTS //load from xml! gui.loadSettings("controlPanelSettings.xml"); //if you want to use events call this after you have added all your gui elements gui.setupEvents(); gui.enableEvents(); bShowMouse = true; //gui.toggleView(); //show it by default }
//-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofBackground(0, 0, 0); //audio // 0 output channels, // 2 input channels // 22050 samples per second // 256 samples per buffer // 4 num buffers (latency) ofSoundStreamSetup(0,2,this, 44100, 256, 4); left = new float[256]; right = new float[256]; audioLevel = 0.f; //box2d box2d.init(); box2d.setGravity(0,0); box2d.createBounds(); box2d.setFPS(30); box2d.registerGrabbing(); box2d.createGround();//defaults to the bottom of the screen, nice ofEnableSmoothing(); ofSetFrameRate(30); clearBack = true; ofSetBackgroundAuto(clearBack); // shapeDirLister.setVerbose(false); // shapeDirLister.allowExt("xml"); // int nShapes = shapeDirLister.listDir("shapes"); // // cout << nShapes << " found." << endl; ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 60, 200)); ofxControlPanel::setTextColor(simpleColor(240, 50, 50, 255)); gui.loadFont("MONACO.TTF", 8); gui.setup("Hellicar&Lewis Norwegian Wood Audio Reactive Projection", 0, 0, ofGetWidth(), 700); gui.addPanel("Basic Settings", 4, false); ofxControlPanel::setBackgroundColor(simpleColor(30, 30, 30, 200)); //--------- PANEL 1 gui.setWhichPanel(0); gui.setWhichColumn(0); //some dummy vars we will update to show the variable lister object elapsedTime = ofGetElapsedTimef(); appFrameCount = ofGetFrameNum(); appFrameRate = ofGetFrameRate(); vector <guiVariablePointer> vars; vars.push_back( guiVariablePointer("ellapsed time", &elapsedTime, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("ellapsed frames", &appFrameCount, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("app fps", &appFrameRate, GUI_VAR_FLOAT, 2) ); vars.push_back( guiVariablePointer("mouse x", &mouseX, GUI_VAR_INT) ); vars.push_back( guiVariablePointer("mouse y", &mouseY, GUI_VAR_INT) ); gui.addVariableLister("app vars", vars); gui.addChartPlotter("Audio level", guiStatVarPointer("Audio Level", &audioLevel, GUI_VAR_FLOAT, true, 2), 200, 100, 200, 0.f, 1.f); gui.addSlider("Audio Cut Down", "AUDIO_CUT_DOWN", 0.1f, 0.f,1.f, false); gui.addSlider("Audio Cut Up", "AUDIO_CUT_UP", 0.9f, 0.f,1.f, false); gui.addSlider("Audio Boost ", "AUDIO_BOOST", 0.0f, 0.f,1.f, false); timeOfLastFrame = ofGetElapsedTimef(); bShowMouse = false; ofHideCursor(); loadPolyShapeFromXML("shapes/blossom.xml"); loadPolyShapeFromXML("shapes/leaf.xml"); //now the scenes spring.setup("Spring", &gui, &box2d, polyShapes[0]); summer.setup("Summer", &gui, &box2d); autumn.setup("Autumn", &gui, &box2d, polyShapes[1]); winter.setup("Winter", &gui, &box2d); currentScene = &spring; spring.init(); //SETTINGS AND EVENTS //load from xml! gui.loadSettings("controlPanelSettings.xml"); //if you want to use events call this after you have added all your gui elements gui.setupEvents(); gui.enableEvents(); gui.hide(); }