Skip to content

Commit

Permalink
ofxGui: Changed instances of ofVec*f and ofPoint into GLM (#6207)
Browse files Browse the repository at this point in the history
#changelog  #addons #ofxGui
  • Loading branch information
roymacdonald authored and arturoc committed Mar 22, 2019
1 parent 60281fb commit 1ad1022
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions addons/ofxGui/src/ofxBaseGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void ofxBaseGui::setName(const std::string& _name){
setNeedsRedraw();
}

void ofxBaseGui::setPosition(const ofPoint & p){
void ofxBaseGui::setPosition(const glm::vec3 & p){
setPosition(p.x, p.y);
}

Expand All @@ -285,8 +285,8 @@ void ofxBaseGui::setShape(float x, float y, float w, float h){
sizeChangedCB();
}

ofPoint ofxBaseGui::getPosition() const {
return ofPoint(b.x, b.y);
glm::vec3 ofxBaseGui::getPosition() const {
return glm::vec3(b.x, b.y, 0);
}

ofRectangle ofxBaseGui::getShape() const {
Expand Down
4 changes: 2 additions & 2 deletions addons/ofxGui/src/ofxBaseGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class ofxBaseGui {
std::string getName();
void setName(const std::string& name);

virtual void setPosition(const ofPoint & p);
virtual void setPosition(const glm::vec3 & p);
virtual void setPosition(float x, float y);
virtual void setSize(float w, float h);
virtual void setShape(ofRectangle r);
virtual void setShape(float x, float y, float w, float h);

ofPoint getPosition() const;
glm::vec3 getPosition() const;
ofRectangle getShape() const;
float getWidth() const;
float getHeight() const;
Expand Down
10 changes: 5 additions & 5 deletions addons/ofxGui/src/ofxGuiGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ bool ofxGuiGroup::mouseMoved(ofMouseEventArgs & args){
return true;
}
}
if(b.inside(ofPoint(args.x, args.y))){
if(b.inside(args)){
return true;
}else{
return false;
Expand Down Expand Up @@ -314,7 +314,7 @@ bool ofxGuiGroup::mouseScrolled(ofMouseEventArgs & args){
return true;
}
}
if(b.inside(ofPoint(args.x, args.y))){
if(b.inside(args)){
return true;
}else{
return false;
Expand Down Expand Up @@ -529,8 +529,8 @@ ofAbstractParameter & ofxGuiGroup::getParameter(){
return parameters;
}

void ofxGuiGroup::setPosition(const ofPoint& p){
ofVec2f diff = p - b.getPosition();
void ofxGuiGroup::setPosition(const glm::vec3& p){
auto diff = p - b.getPosition();

for(std::size_t i = 0; i < collection.size(); i++){
collection[i]->setPosition(collection[i]->getPosition() + diff);
Expand All @@ -541,7 +541,7 @@ void ofxGuiGroup::setPosition(const ofPoint& p){
}

void ofxGuiGroup::setPosition(float x, float y){
setPosition(ofVec2f(x, y));
setPosition({x, y, 0});
}

void ofxGuiGroup::enableHeader(){
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxGuiGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ofxGuiGroup : public ofxBaseGui {

virtual ofAbstractParameter & getParameter();

virtual void setPosition(const ofPoint& p);
virtual void setPosition(const glm::vec3& p);
virtual void setPosition(float x, float y);

void enableHeader();
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ bool ofxPanel::setValue(float mx, float my, bool bCheck){

if( headerRect.inside(mx, my)){
bGrabbed = true;
grabPt.set(mx-b.x, my-b.y);
grabPt = {mx-b.x, my-b.y, 0};
return true;
} else{
bGrabbed = false;
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class ofxPanel : public ofxGuiGroup {
ofRectangle loadBox, saveBox;
ofImage loadIcon, saveIcon;

ofPoint grabPt;
glm::vec3 grabPt;
bool bGrabbed;
};
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void ofxSlider<Type>::valueChanged(Type & value){
}

template<typename Type>
void ofxSlider<Type>::setPosition(const ofPoint & p){
void ofxSlider<Type>::setPosition(const glm::vec3 & p){
ofxBaseGui::setPosition(p);
input.setPosition(p);
}
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxSlider.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ofxSlider : public ofxBaseGui{
operator const Type & ();


virtual void setPosition(const ofPoint & p);
virtual void setPosition(const glm::vec3 & p);
virtual void setPosition(float x, float y);
virtual void setSize(float w, float h);
virtual void setShape(ofRectangle r);
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxGui/src/ofxSliderGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ofxVecSlider_ : public ofxGuiGroup {
typedef ofxVecSlider_<ofDefaultVec3> ofxVec3Slider;
typedef ofxVecSlider_<ofDefaultVec2> ofxVec2Slider;
typedef ofxVecSlider_<ofDefaultVec4> ofxVec4Slider;
typedef ofxVecSlider_<ofVec3f> ofxPointSlider;
typedef ofxVecSlider_<glm::vec3> ofxPointSlider;

template<typename ColorType>
class ofxColorSlider_: public ofxGuiGroup{
Expand Down
6 changes: 3 additions & 3 deletions addons/ofxGui/src/ofxToggle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ofxToggle * ofxToggle::setup(const std::string& toggleName, bool _bVal, float wi


bool ofxToggle::mouseMoved(ofMouseEventArgs & args){
if(isGuiDrawing() && b.inside(ofPoint(args.x,args.y))){
if(isGuiDrawing() && b.inside(args)){
return true;
}else{
return false;
Expand All @@ -50,7 +50,7 @@ bool ofxToggle::mousePressed(ofMouseEventArgs & args){
}

bool ofxToggle::mouseDragged(ofMouseEventArgs & args){
if(bGuiActive && b.inside(ofPoint(args.x,args.y))){
if(bGuiActive && b.inside(args)){
return true;
}else{
return false;
Expand All @@ -60,7 +60,7 @@ bool ofxToggle::mouseDragged(ofMouseEventArgs & args){
bool ofxToggle::mouseReleased(ofMouseEventArgs & args){
bool wasGuiActive = bGuiActive;
bGuiActive = false;
if(wasGuiActive && b.inside(ofPoint(args.x,args.y))){
if(wasGuiActive && b.inside(args)){
return true;
}else{
return false;
Expand Down

0 comments on commit 1ad1022

Please sign in to comment.