//---------- void Board::populateInspector(ElementGroupPtr inspector) { auto sliderCallback = [this](ofParameter<float> &) { this->updatePreviewMesh(); }; auto typeChooser = make_shared<Widgets::MultipleChoice>("Board type"); typeChooser->addOption("Checkerboard"); typeChooser->addOption("Circles"); typeChooser->setSelection(this->boardType); typeChooser->onValueChange += [this](const int & selectionIndex) { this->boardType = selectionIndex; this->updatePreviewMesh(); }; inspector->add(typeChooser); Utils::Gui::addIntSlider(this->sizeX, inspector)->onValueChange += sliderCallback; Utils::Gui::addIntSlider(this->sizeY, inspector)->onValueChange += sliderCallback; inspector->add(Widgets::Title::make("NB : Checkerboard size is\n counted by number of\n inner corners", Widgets::Title::Level::H3)); inspector->add(ofxCvGui::Widgets::LiveValue<string>::make("Warning", [this]() { if (this->boardType == 0) { //CHECKERBOARD bool xOdd = (int) this->sizeX & 1; bool yOdd = (int) this->sizeY & 1; if (xOdd && yOdd) { return "Size X and Size Y are both odd"; } else if (!xOdd && !yOdd) { return "Size X and Size Y are both even"; } else { return ""; } } else { //CIRCLES return ""; } })); inspector->add(Widgets::Spacer::make()); auto spacingSlider = Widgets::Slider::make(this->spacing); spacingSlider->onValueChange += sliderCallback; inspector->add(spacingSlider); }
//---------- void Projector::populateInspector(ElementGroupPtr inspector) { inspector->add(Widgets::EditableValue<float>::make("Resolution width", [this]() { return this->getWidth(); }, [this](string valueString) { const auto value = ofToFloat(valueString); if (value > 0) { this->setWidth(value); } })); inspector->add(Widgets::EditableValue<float>::make("Resolution height", [this]() { return this->getHeight(); }, [this](string valueString) { const auto value = ofToFloat(valueString); if (value > 0) { this->setHeight(value); } })); }