Advertisement
Guest User

kolo.cpp

a guest
May 4th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. //kolo.cpp
  2.  
  3. #include "kolo.h"
  4. #include <QGLFunctions>
  5. #include <math.h>
  6.  
  7.  
  8.  const double Kolo::stopien=3.14159265359/180.;
  9.  
  10. Kolo::Kolo(double x_, double y_, double r_, double R_, double G_, double B_): x(x_), y(y_), r(r_), R(R_), G(G_), B(B_)
  11. {
  12.  
  13. }
  14.  
  15. Kolo::~Kolo()
  16. {
  17.  
  18. }
  19.  
  20. void Kolo::rysuj()
  21. {
  22.     glPushMatrix();
  23.     glTranslated(x,y,0);
  24.     glColor3d(R,G,B);
  25.     glBegin(GL_TRIANGLE_FAN);
  26.     glVertex2d(0,0);
  27.     for(int i=0;i<=361;i++)
  28.         glVertex2d(sin(i*stopien)*r,cos(i*stopien)*r);
  29.     glEnd();
  30.     glPopMatrix();
  31. }
  32. double Kolo::getX() const
  33. {
  34.     return x;
  35. }
  36.  
  37. void Kolo::setX(double value)
  38. {
  39.     x = value;
  40. }
  41.  
  42. void Kolo::changeX(double inc)
  43. {
  44.     x+=inc;
  45. }
  46. double Kolo::getY() const
  47. {
  48.     return y;
  49. }
  50.  
  51. void Kolo::setY(double value)
  52. {
  53.     y = value;
  54. }
  55.  
  56. void Kolo::changeY(double inc)
  57. {
  58.     y+=inc;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement