| 6 | */ |
| 7 | |
| 8 | void ofApp::setup() |
| 9 | { |
| 10 | ang1 = ang2 = 0.0f; |
| 11 | ofSetWindowShape(1920, 1200); |
| 12 | ofSetWindowPosition(ofGetScreenWidth()/2 - ofGetWidth()/2, 0); |
| 13 | |
| 14 | // setup our gui // |
| 15 | gui = new ofxDatGui(); |
| 16 | gui->setWidth(1200, .2); |
| 17 | gui->setLabelAlignment(ofxDatGuiAlignment::CENTER); |
| 18 | gui->addHeader("wave monitor & value plotter example"); |
| 19 | gui->addFooter(); |
| 20 | |
| 21 | // add a wave monitor with a frequency of 3 & amplitude of 50% // |
| 22 | m1 = gui->addWaveMonitor("wave monitor", 3, .5); |
| 23 | s1 = gui->addSlider("frequency", 0, 50, 5); |
| 24 | // amplitude multiplier must be a value between 0 & 1 // |
| 25 | s2 = gui->addSlider("amplitude", 0, 1); |
| 26 | // we'll animate it on a sine wave so let's disable user input // |
| 27 | s2->setEnabled(false); |
| 28 | |
| 29 | gui->addBreak()->setHeight(20); |
| 30 | |
| 31 | // add a couple value plotters with a range of 0 - 100 // |
| 32 | p1 = gui->addValuePlotter("value plotter", 0, 100); |
| 33 | p2 = gui->addValuePlotter("point plotter", 0, 100); |
| 34 | p2->setDrawMode(ofxDatGuiGraph::POINTS); |
| 35 | gui->addSlider("multiplier", 0, 1, .10); |
| 36 | gui->addSlider("sweep speed", 0, 30, 10); |
| 37 | gui->addBreak()->setHeight(20); |
| 38 | |
| 39 | // add a dropdown to select between the four draw modes // |
| 40 | vector<string> drawModes = {"lines", "filled", "points", "outline"}; |
| 41 | dd = gui->addDropdown("select draw mode", drawModes); |
| 42 | |
| 43 | // set the frequency and amplitude // |
| 44 | m1->setFrequency(s1->getValue()); |
| 45 | m1->setAmplitude(s2->getValue()); |
| 46 | |
| 47 | p1->setSpeed(gui->getSlider("sweep speed")->getValue()); |
| 48 | |
| 49 | gui->setPosition(ofGetWidth()/2 - gui->getWidth()/2, 140); |
| 50 | gui->onSliderEvent(this, &ofApp::onGuiSliderEvent); |
| 51 | gui->onDropdownEvent(this, &ofApp::onGuiDropdownEvent); |
| 52 | } |
| 53 | |
| 54 | void ofApp::onGuiSliderEvent(ofxDatGuiSliderEvent e) |
| 55 | { |
nothing calls this directly
no test coverage detected