Skip to content

Commit

Permalink
Updated to work with the latest on master of ofxMSAInteractiveObject.…
Browse files Browse the repository at this point in the history
… Example project now works
  • Loading branch information
Dimitris committed Dec 11, 2013
1 parent 02b3480 commit 7eb543c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/shapes/ofxMtlMapping2DPolygon.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void ofxMtlMapping2DPolygon::updatePosition(int xInc, int yInc)
list<ofxMtlMapping2DVertex*>::iterator it;
for (it=vertices.begin(); it!=vertices.end(); it++) {
ofxMtlMapping2DVertex* vertex = *it;
vertex->setPos(vertex->x + xInc, vertex->y + yInc);
vertex->setPosition(vertex->x + xInc, vertex->y + yInc);
vertex->updateCenter();
}

Expand Down Expand Up @@ -222,7 +222,7 @@ void ofxMtlMapping2DPolygon::updatePolyline()

// ---- Interactive obj
boundingBox = polyline->getBoundingBox();
setPos(boundingBox.x, boundingBox.y);
setPosition(boundingBox.x, boundingBox.y);
setSize(boundingBox.width, boundingBox.height);
}

Expand Down
22 changes: 13 additions & 9 deletions src/shapes/ofxMtlMapping2DVertex.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ofxMtlMapping2DVertex::~ofxMtlMapping2DVertex()
void ofxMtlMapping2DVertex::init(float _x, float _y, int _index)
{
index = _index;
setPos(_x, _y);
setPosition(_x, _y);

//Center
updateCenter();
Expand All @@ -41,7 +41,7 @@ void ofxMtlMapping2DVertex::kill()
activeVertex = NULL;
}

killMe();
delete this;
}

//--------------------------------------------------------------
Expand All @@ -54,7 +54,7 @@ void ofxMtlMapping2DVertex::update()
void ofxMtlMapping2DVertex::drawBack()
{
ofFill();
if(isMouseDown() || activeVertex == this) {
if(activeVertex == this) {
ofSetColor(255, 255, 255, 150);
ofCircle(x+15, y+15, 20);
} else if(isMouseOver()) {
Expand All @@ -69,7 +69,7 @@ void ofxMtlMapping2DVertex::drawBack()
void ofxMtlMapping2DVertex::drawTop()
{
ofNoFill();
if(isMouseDown() || activeVertex == this) {
if(activeVertex == this) {
ofSetColor(255, 255, 0, 150);
} else if(isMouseOver()) {
ofSetColor(255, 0, 0, 120);
Expand All @@ -96,7 +96,7 @@ void ofxMtlMapping2DVertex::updateCenter()
//--------------------------------------------------------------
void ofxMtlMapping2DVertex::snapIt(float _x, float _y)
{
setPos(_x, _y);
setPosition(_x, _y);
updateCenter();
}

Expand All @@ -106,25 +106,29 @@ void ofxMtlMapping2DVertex::snapIt(float _x, float _y)
//--------------------------------------------------------------
void ofxMtlMapping2DVertex::left()
{
snapIt(x-1, y);
if(activeVertex)
snapIt(x-1, y);
}

//--------------------------------------------------------------
void ofxMtlMapping2DVertex::up()
{
snapIt(x, y-1);
if(activeVertex)
snapIt(x, y-1);
}

//--------------------------------------------------------------
void ofxMtlMapping2DVertex::right()
{
snapIt(x+1, y);
if(activeVertex)
snapIt(x+1, y);
}

//--------------------------------------------------------------
void ofxMtlMapping2DVertex::down()
{
snapIt(x, y+1);
if(activeVertex)
snapIt(x, y+1);
}


Expand Down

0 comments on commit 7eb543c

Please sign in to comment.