summaryrefslogtreecommitdiffstats
path: root/Project/Transformer.cpp
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-09-05 18:43:50 -0300
committerThales1330 <thaleslima.ufu@gmail.com>2016-09-05 18:43:50 -0300
commitd93ef357da510f2515556ff2cb51688a4e068805 (patch)
treeda24ff514d5d507252681365d7cda6b08576af23 /Project/Transformer.cpp
parent47cebfc84d4ae315f4bf8ffb3d074b2b75781a1b (diff)
downloadPSP.git-d93ef357da510f2515556ff2cb51688a4e068805.tar.gz
PSP.git-d93ef357da510f2515556ff2cb51688a4e068805.tar.xz
PSP.git-d93ef357da510f2515556ff2cb51688a4e068805.zip
All elements implemented, switches implemented
Diffstat (limited to 'Project/Transformer.cpp')
-rw-r--r--Project/Transformer.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/Project/Transformer.cpp b/Project/Transformer.cpp
index cb18d2f..ce1d12e 100644
--- a/Project/Transformer.cpp
+++ b/Project/Transformer.cpp
@@ -15,6 +15,10 @@ bool Transformer::AddParent(Element* parent, wxPoint2DDouble position)
parentPt = parent->RotateAtPosition(parentPt, parent->GetAngle()); // Rotate back.
m_pointList.push_back(parentPt); // First point
m_pointList.push_back(GetSwitchPoint(parent, parentPt, m_position));
+
+ wxRect2DDouble genRect(0,0,0,0);
+ m_switchRect.push_back(genRect);
+
return false;
}
// Second bus.
@@ -51,6 +55,11 @@ bool Transformer::AddParent(Element* parent, wxPoint2DDouble position)
m_pointList.push_back(parentPt); // Last point.
m_inserted = true;
+
+ wxRect2DDouble genRect(0,0,0,0);
+ m_switchRect.push_back(genRect);
+ UpdateSwitches();
+
return true;
}
}
@@ -78,7 +87,6 @@ void Transformer::Draw(wxPoint2DDouble translation, double scale) const
glRotated(m_angle, 0.0, 0.0, 1.0);
glTranslated(-m_position.m_x, -m_position.m_y, 0.0);
- // glColor4d(0.0, 0.5, 1.0, 0.5);
DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(20.0, 20.0), 20 + (m_borderSize + 1.5) / scale,
20, GL_POLYGON);
DrawCircle(m_rect.GetPosition() + wxPoint2DDouble(50.0, 20.0), 20 + (m_borderSize + 1.5) / scale,
@@ -109,7 +117,9 @@ void Transformer::Draw(wxPoint2DDouble translation, double scale) const
DrawCircle(m_pointList[m_pointList.size() - 1], 5.0, 10, GL_POLYGON);
}
}
-
+
+ DrawSwitches();
+
// Push the current matrix on stack.
glPushMatrix();
// Rotate the matrix around the object position.
@@ -185,11 +195,13 @@ void Transformer::MoveNode(Element* parent, wxPoint2DDouble position)
if(m_activeNodeID == 1) {
m_pointList[0] = m_movePts[0] + position - m_moveStartPt;
m_parentList[0] = NULL;
+ m_online = false;
}
else if(m_activeNodeID == 2)
{
m_pointList[m_pointList.size() - 1] = m_movePts[m_pointList.size() - 1] + position - m_moveStartPt;
m_parentList[1] = NULL;
+ m_online = false;
}
}