From 78aac544e1e77f5405260797cee4b94d7a0dfe32 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Tue, 2 Aug 2016 17:34:42 -0300 Subject: Bus controllers under implementation Events handler removed --- Project/Element.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Project/Element.cpp') diff --git a/Project/Element.cpp b/Project/Element.cpp index e5304a0..984eb65 100644 --- a/Project/Element.cpp +++ b/Project/Element.cpp @@ -35,3 +35,31 @@ void Element::DrawRectangle(wxPoint2DDouble position, double width, double heigh glVertex2d(position.m_x + width / 2.0, position.m_y - height / 2.0); glEnd(); } + +void Element::DrawRectangle(wxPoint2DDouble* points, GLenum mode) const +{ + glBegin(mode); // TODO: GL_QUADS é obsoleto (OpenGL 3.0+), encontrar outra solução. + glVertex2d(points[0].m_x, points[0].m_y); + glVertex2d(points[1].m_x, points[1].m_y); + glVertex2d(points[2].m_x, points[2].m_y); + glVertex2d(points[3].m_x, points[3].m_y); + glEnd(); +} + +void Element::DrawPickbox(wxPoint2DDouble position) const +{ + glColor4d(1.0, 1.0, 1.0, 0.8); + DrawRectangle(position, 8.0, 8.0); + glColor4d(0.0, 0.0, 0.0, 1.0); + DrawRectangle(position, 8.0, 8.0, GL_LINE_LOOP); +} + +wxPoint2DDouble Element::RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees) const +{ + double radAngle = angle; + if(degrees) radAngle = wxDegToRad(angle); + return wxPoint2DDouble(std::cos(radAngle) * (pointToRotate.m_x - m_position.m_x) - + std::sin(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_x, + std::sin(radAngle) * (pointToRotate.m_x - m_position.m_x) + + std::cos(radAngle) * (pointToRotate.m_y - m_position.m_y) + m_position.m_y); +} -- cgit