Skip to content

Instantly share code, notes, and snippets.

@Foaly
Last active August 29, 2015 14:15
Show Gist options
  • Save Foaly/fc70636a3cda475528d2 to your computer and use it in GitHub Desktop.
Save Foaly/fc70636a3cda475528d2 to your computer and use it in GitHub Desktop.
Diff for ofxSimpleGuiToo
diff --git a/src/Controls/ofxSimpleGuiButton.cpp b/src/Controls/ofxSimpleGuiButton.cpp
index cc3e137..23050e9 100644
--- a/src/Controls/ofxSimpleGuiButton.cpp
+++ b/src/Controls/ofxSimpleGuiButton.cpp
@@ -58,7 +58,7 @@ void ofxSimpleGuiButton::onRelease(int x, int y, int button) {
}
void ofxSimpleGuiButton::draw(float x, float y) {
- setPos(x, y);
+ setPosition(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
diff --git a/src/Controls/ofxSimpleGuiColorPicker.cpp b/src/Controls/ofxSimpleGuiColorPicker.cpp
index a4318bb..b8dd60b 100644
--- a/src/Controls/ofxSimpleGuiColorPicker.cpp
+++ b/src/Controls/ofxSimpleGuiColorPicker.cpp
@@ -102,7 +102,7 @@ void ofxSimpleGuiColorPicker::draw(float x, float y) {
// enabled = true;
//update postion of gui object
- setPos(x, y);
+ setPosition(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
@@ -126,14 +126,14 @@ void ofxSimpleGuiColorPicker::draw(float x, float y) {
case 3:glColor3f(getValue(i), getValue(i), getValue(i)); break;
}
*/
-
+
switch(i) {
case 0:glColor3f(1, 0, 0); break;
case 1:glColor3f(0, 1, 0); break;
case 2:glColor3f(0, 0, 1); break;
case 3:glColor3f(getValue(i), getValue(i), getValue(i)); break;
}
-
+
//ofRect(0, startY, barwidth[i], config->colorSliderHeight * 1.5); // was * 1.8
//ofRect(0, startY, barwidth[i], config->sliderHeight);
diff --git a/src/Controls/ofxSimpleGuiComboBox.cpp b/src/Controls/ofxSimpleGuiComboBox.cpp
index f36edba..b7442cc 100644
--- a/src/Controls/ofxSimpleGuiComboBox.cpp
+++ b/src/Controls/ofxSimpleGuiComboBox.cpp
@@ -210,7 +210,7 @@ void ofxSimpleGuiComboBox::draw(float x, float y) {
//we assume a max of 256 characters.
char choiceBuf[256];
- setPos(x, y);
+ setPosition(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
diff --git a/src/Controls/ofxSimpleGuiContent.cpp b/src/Controls/ofxSimpleGuiContent.cpp
old mode 100755
new mode 100644
index ed410e2..ed28336
--- a/src/Controls/ofxSimpleGuiContent.cpp
+++ b/src/Controls/ofxSimpleGuiContent.cpp
@@ -17,7 +17,7 @@ void ofxSimpleGuiContent::setup() {
void ofxSimpleGuiContent::draw(float x, float y) {
if(content->getWidth() == 0 && content->getHeight() ==0) return;
- setPos(x, y);
+ setPosition(x, y);
setup();
glPushMatrix();
diff --git a/src/Controls/ofxSimpleGuiFPSCounter.cpp b/src/Controls/ofxSimpleGuiFPSCounter.cpp
old mode 100755
new mode 100644
index 890300c..206c589
--- a/src/Controls/ofxSimpleGuiFPSCounter.cpp
+++ b/src/Controls/ofxSimpleGuiFPSCounter.cpp
@@ -12,18 +12,18 @@ void ofxSimpleGuiFPSCounter::setup() {
void ofxSimpleGuiFPSCounter::draw(float x, float y) {
- setPos(x, y);
-
+ setPosition(x, y);
+
glPushMatrix();
glTranslatef(x, y, 0);
-
+
ofEnableAlphaBlending();
ofFill();
setTextBGColor(false);
ofRect(0, 0, width, height);
-
+
setTextColor(false);
ofDrawBitmapString("FPS: " + ofToString(ofGetFrameRate()), 3, 15);
-
+
glPopMatrix();
-}
\ No newline at end of file
+}
diff --git a/src/Controls/ofxSimpleGuiQuadWarp.cpp b/src/Controls/ofxSimpleGuiQuadWarp.cpp
index 864ae6b..319453e 100644
--- a/src/Controls/ofxSimpleGuiQuadWarp.cpp
+++ b/src/Controls/ofxSimpleGuiQuadWarp.cpp
@@ -6,21 +6,21 @@
//---------------------------------------------------------------------
ofxSimpleGuiQuadWarp::ofxSimpleGuiQuadWarp(string name, ofBaseDraws &baseDraw, ofPoint *pts) : ofxSimpleGuiControl(name) {
this->baseDraw = &baseDraw;
-
- setPos(0, 0);
+
+ setPosition(0, 0);
setSize(baseDraw.getWidth(), baseDraw.getHeight());
-
+
curPoint = NULL;
this->pts = pts;
-
+
for(int i=0; i<4; i++) pts[i].z = i; // z axis stores the index
-
+
controlType = "QuadWarp";
setup();
}
void ofxSimpleGuiQuadWarp::setup() {
-
+
}
@@ -52,7 +52,7 @@ void ofxSimpleGuiQuadWarp::onPress(int x, int y, int button) {
curPoint = pts + i;
}
}
-
+
// if doubleclick, reset
if(ofDistSquared(x, y, lastPressPlace.x, lastPressPlace.y) < MOUSE_DISTANCE * MOUSE_DISTANCE && ofGetElapsedTimef() - lastPressTime < 0.25f) {
// pts[0].set(0, 0);
@@ -60,15 +60,15 @@ void ofxSimpleGuiQuadWarp::onPress(int x, int y, int button) {
// pts[2].set(width, height);
// pts[3].set(0, height);
if(curPoint) {
- switch((int)curPoint->z) { // stores index of point
+ switch((int)curPoint->z) { // stores index of point
case 0: pts[0].set(0, 0); break;
case 1: pts[1].set(width, 0); break;
case 2: pts[2].set(width, height); break;
case 3: pts[3].set(0, height); break;
- }
+ }
}
}
-
+
lastPressPlace.set(x, y);
lastPressTime = ofGetElapsedTimef();
}
@@ -82,7 +82,7 @@ void ofxSimpleGuiQuadWarp::onDragOver(int x, int y, int button) {
if(curPoint) {
curPoint->set(x - this->x, y - this->y);
}
-
+
}
//---------------------------------------------------------------------
@@ -94,15 +94,15 @@ void ofxSimpleGuiQuadWarp::onDragOutside(int x, int y, int button) {
//---------------------------------------------------------------------
void ofxSimpleGuiQuadWarp::draw(float x, float y) {
- setPos(x, y);
+ setPosition(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
glColor3f(1, 1, 1);
baseDraw->draw(0, 0);
-
+
ofEnableAlphaBlending();
ofFill();
-
+
for(int i=0; i<4; i++) {
if(curPoint == &pts[i]) {
ofSetColor(255, 0, 0);
@@ -111,10 +111,10 @@ void ofxSimpleGuiQuadWarp::draw(float x, float y) {
ofSetColor(0, 255, 0);
ofCircle(pts[i].x, pts[i].y, 2);
}
-
+
}
-
-
+
+
ofBeginShape();
ofNoFill();
ofSetColor(255, 255, 255);
@@ -123,6 +123,6 @@ void ofxSimpleGuiQuadWarp::draw(float x, float y) {
}
ofEndShape(TRUE);
ofDisableAlphaBlending();
-
+
glPopMatrix();
}
diff --git a/src/Controls/ofxSimpleGuiSlider2d.cpp b/src/Controls/ofxSimpleGuiSlider2d.cpp
index 75aecf8..10c52ed 100644
--- a/src/Controls/ofxSimpleGuiSlider2d.cpp
+++ b/src/Controls/ofxSimpleGuiSlider2d.cpp
@@ -81,7 +81,7 @@ void ofxSimpleGuiSlider2d::update() {
}
void ofxSimpleGuiSlider2d::draw(float x, float y) {
- setPos(x, y);
+ setPosition(x, y);
ofPoint pointv;
pointv.x = ofMap((*value).x, min.x, max.x, x, x+width);
pointv.y = ofMap((*value).y, min.y, max.y, y, y+height-config->slider2DTextHeight);
diff --git a/src/Controls/ofxSimpleGuiSliderBase.h b/src/Controls/ofxSimpleGuiSliderBase.h
index be45787..314ad38 100644
--- a/src/Controls/ofxSimpleGuiSliderBase.h
+++ b/src/Controls/ofxSimpleGuiSliderBase.h
@@ -206,7 +206,7 @@ public:
// enabled = true;
//update postion of gui object
- setPos(x, y);
+ setPosition(x, y);
//VALUE CLAMP
barwidth = ofMap((*value), min, max, 0.0, (float)width);
diff --git a/src/Controls/ofxSimpleGuiTitle.cpp b/src/Controls/ofxSimpleGuiTitle.cpp
index 96a87c3..8791632 100644
--- a/src/Controls/ofxSimpleGuiTitle.cpp
+++ b/src/Controls/ofxSimpleGuiTitle.cpp
@@ -64,7 +64,7 @@ void ofxSimpleGuiTitle::onRelease(int x, int y, int button) {
}
void ofxSimpleGuiTitle::draw(float x, float y) {
- setPos(x, y);
+ setPosition(x, y);
if(hasTitle == false) return;
diff --git a/src/Controls/ofxSimpleGuiToggle.cpp b/src/Controls/ofxSimpleGuiToggle.cpp
index 4c60ab2..fc1ae40 100644
--- a/src/Controls/ofxSimpleGuiToggle.cpp
+++ b/src/Controls/ofxSimpleGuiToggle.cpp
@@ -81,7 +81,7 @@ void ofxSimpleGuiToggle::update() {
void ofxSimpleGuiToggle::draw(float x, float y) {
// enabled = true;
- setPos(x, y);
+ setPosition(x, y);
glPushMatrix();
glTranslatef(x, y, 0);
diff --git a/src/ofxSimpleGuiControl.cpp b/src/ofxSimpleGuiControl.cpp
index 5c4b1f7..ab47fca 100644
--- a/src/ofxSimpleGuiControl.cpp
+++ b/src/ofxSimpleGuiControl.cpp
@@ -42,7 +42,7 @@ ofxSimpleGuiControl::ofxSimpleGuiControl(string name) {
this->config = &defaultSimpleGuiConfig;
setName(name);
setKey(key);
- setPos(0, 0);
+ setPosition(0, 0);
lock = false;
focused = false;
newColumn = false;
@@ -103,7 +103,7 @@ ofxSimpleGuiControl &ofxSimpleGuiControl::setTextBGColor(bool clickable) {
}
ofxSimpleGuiControl &ofxSimpleGuiControl::setFullColor(bool forceActive) {
- if(isMouseDown() || forceActive) ofSetHexColor(config->fullActiveColor);
+ if(isMousePressed() || forceActive) ofSetHexColor(config->fullActiveColor);
else if(isMouseOver()) ofSetHexColor(config->fullOverColor);
else ofSetHexColor(config->fullColor);
return *this;
diff --git a/src/ofxSimpleGuiPage.cpp b/src/ofxSimpleGuiPage.cpp
index 2142b2b..54050ce 100644
--- a/src/ofxSimpleGuiPage.cpp
+++ b/src/ofxSimpleGuiPage.cpp
@@ -101,7 +101,7 @@ float ofxSimpleGuiPage::getNextY(float y) {
void ofxSimpleGuiPage::draw(float x, float y, bool alignRight) {
- setPos(x += config->offset.x, y += config->offset.y);
+ setPosition(x += config->offset.x, y += config->offset.y);
if(alignRight) x = ofGetWidth() - x - config->gridSize.x;
float posX = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment