From 7d965bd8c7587f4fd49485876938901b8facac82 Mon Sep 17 00:00:00 2001 From: thomwolf Date: Wed, 13 Jul 2016 15:10:13 +0200 Subject: [PATCH 1/2] Minor change to Colorpicker setColor to update vbo ColorData as well --- src/components/ofxDatGuiColorPicker.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/ofxDatGuiColorPicker.h b/src/components/ofxDatGuiColorPicker.h index e47996f..5903566 100644 --- a/src/components/ofxDatGuiColorPicker.h +++ b/src/components/ofxDatGuiColorPicker.h @@ -75,18 +75,21 @@ class ofxDatGuiColorPicker : public ofxDatGuiTextInput { { mColor = color; setTextFieldInputColor(); + gColors[2] = mColor; + gColors[0] = ofColor(mColor.r/2, mColor.g/2, mColor.b/2); + vbo.setColorData(&gColors[0], 6, GL_DYNAMIC_DRAW ); } - + void setColor(int hex) { mColor = ofColor::fromHex(hex); - setTextFieldInputColor(); + setColor(mColor); } - + void setColor(int r, int g, int b, int a = 255) { mColor = ofColor(r, g, b, a); - setTextFieldInputColor(); + setColor(mColor); } ofColor getColor() From deea0af6a7e918eb180ee929e07a46d583396a8e Mon Sep 17 00:00:00 2001 From: thomwolf Date: Wed, 13 Jul 2016 15:32:16 +0200 Subject: [PATCH 2/2] Added setOptions to Dropdown --- src/components/ofxDatGuiGroups.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/ofxDatGuiGroups.h b/src/components/ofxDatGuiGroups.h index 2c0c8ed..012135c 100644 --- a/src/components/ofxDatGuiGroups.h +++ b/src/components/ofxDatGuiGroups.h @@ -484,6 +484,18 @@ class ofxDatGuiDropdown : public ofxDatGuiGroup { return children.size(); } + void setOptions(const vector& options = vector()) + { + mOption = 0; + children.clear(); + for(int i=0; isetIndex(children.size()); + opt->onButtonEvent(this, &ofxDatGuiDropdown::onOptionSelected); + children.push_back(opt); + } + } + ofxDatGuiDropdownOption* getChildAt(int index) { return static_cast(children[index]);