diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-02 17:34:42 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-02 17:34:42 -0300 |
commit | 78aac544e1e77f5405260797cee4b94d7a0dfe32 (patch) | |
tree | 32a71352d3fe13f361f90f51d5389317fd4d7015 /Project/Element.cpp | |
parent | 0ac91e091e52cae5745b14d62f77f905e559cf92 (diff) | |
download | PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.tar.gz PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.tar.xz PSP.git-78aac544e1e77f5405260797cee4b94d7a0dfe32.zip |
Bus controllers under implementation
Events handler removed
Diffstat (limited to 'Project/Element.cpp')
-rw-r--r-- | Project/Element.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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); +} |