Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //kolo.cpp
- #include "kolo.h"
- #include <QGLFunctions>
- #include <math.h>
- const double Kolo::stopien=3.14159265359/180.;
- 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_)
- {
- }
- Kolo::~Kolo()
- {
- }
- void Kolo::rysuj()
- {
- glPushMatrix();
- glTranslated(x,y,0);
- glColor3d(R,G,B);
- glBegin(GL_TRIANGLE_FAN);
- glVertex2d(0,0);
- for(int i=0;i<=361;i++)
- glVertex2d(sin(i*stopien)*r,cos(i*stopien)*r);
- glEnd();
- glPopMatrix();
- }
- double Kolo::getX() const
- {
- return x;
- }
- void Kolo::setX(double value)
- {
- x = value;
- }
- void Kolo::changeX(double inc)
- {
- x+=inc;
- }
- double Kolo::getY() const
- {
- return y;
- }
- void Kolo::setY(double value)
- {
- y = value;
- }
- void Kolo::changeY(double inc)
- {
- y+=inc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement