-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.cpp
More file actions
48 lines (40 loc) · 1002 Bytes
/
Rectangle.cpp
File metadata and controls
48 lines (40 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "Rectangle.h"
#define NDEBUG
#include <GL/freeglut.h>
using namespace MF;
Rectangle::Rectangle(double width, double height, double red, double green, double blue)
: Physics(),
m_size_width(width), m_size_height(height)
{
SetBorders(
-m_size_width / 2, -m_size_height / 2,
m_size_width / 2, m_size_height / 2
);
m_colour_red = red;
m_colour_green = green;
m_colour_blue = blue;
}
Rectangle::~Rectangle()
{
}
void Rectangle::Draw()
{
if (m_flag_show)
{
glPushMatrix();
{
glTranslated(m_position_x, m_position_y, 0.0);
glRotated(m_rotation_z, 0.0, 0.0, 1.0);
glColor3d(m_colour_red, m_colour_green, m_colour_blue);
glBegin(GL_POLYGON);
{
glVertex3d(-m_size_width / 2, m_size_height / 2, 0);
glVertex3d(m_size_width / 2, m_size_height / 2, 0);
glVertex3d(m_size_width / 2, -m_size_height / 2, 0);
glVertex3d(-m_size_width / 2, -m_size_height / 2, 0);
}
glEnd();
}
glPopMatrix();
}
}