Merge branch 'experiment' of git+ssh://repo.or.cz/srv/git/glgame
[glgame.git] / src / line.cpp
blob0a6138b90b42cd1dbe598f86d69d1c91d07bf0c4
1 #include "line.h"
3 // line::line(Coord start_x, Coord start_y, Coord end_x, Coord end_y)
4 // : displayed_obj()
5 // {
6 // s_x = start_x;
7 // s_y = start_y;
8 // e_x = end_x;
9 // e_y = end_y;
10 //
11 // projection_x = fabs ( - end_x + start_x );
12 // projection_y = fabs ( - end_y + start_y );
13 //
14 // length = sqrt ( pow ( projection_x, 2 ) +
15 // pow ( projection_y, 2 )
16 // );
17 //
18 // rotation = atan(projection_y / projection_x) - fast_math::pi/2;
19 //
20 //
21 // PR(projection_x);
22 // PR(projection_y);
23 // PR(rotation);
24 // PR(length);
25 // PR(s_x);
26 // PR(s_y);
27 //
28 //
29 // }
31 line::line(Coord start_x, Coord start_y, Angle rot, Length len) : displayed_obj() {
33 s_x = start_x;
34 s_y = start_y;
35 rotation = rot;
36 length = len;
38 projection_x = length * cos (rotation);
39 projection_y = length * sin (rotation);
43 line::~line()
48 /*!
49 \fn line::display()
51 void line::display()
53 static double toDegrees = fast_math::pi2 / 360;
54 // static GLfloat depth = -5.5f;
56 glPushMatrix();
58 glColor3f(1.0,1.0,1.0);
60 glTranslatef(s_x, s_y, 0);
61 glRotated(rotation / toDegrees, 0.0f, 0.0f, 1.0f);
62 glBegin( GL_LINES );
63 glVertex2f( 0, 0);
64 glVertex2f( 0, length);
65 glEnd();
67 glPopMatrix();
72 /*!
73 \fn line::calculate()
75 void line::calculate()
77 /// @todo implement me