C++图形编程问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 07:13:53
#include<GL/glut.h>
#include<WINDOWS.h>

class screenPt
{
private:
GLint x, y;

public:
screenPt(){
x=y=0;
}

void init(void){
glClearColor(0.0,1.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0,200.0,0.0,50.0);
}

void main(int argc, char **argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE\GLUT_RGBA);
glutInitWindowPosition(100,100);
glutIntWindowSize(640,480);
glutCreateWindow("Midpoint Circle");
init();
glutDisplayFunc(Circle Midpoint);
glutMainLoop();
}

void setCoords(GLint xCoordValue, GLint yCoordValue){
x=xCoordValue;
y=yCoordValue;
}

GLint getx() const{
return x;
}

GLint gety() const{
return y;
}

void incrementx(){
x++;
}

void decrementy(){
y--;
}

};

voi

#include <iostream.h>
#include <conio.h>
#include <graphics.h>
class location {
protected:
int x,y;
public:
location(int initx,int inity);
};
class point:public location {
public:
point(int initx,int inity);
void show();
void hide();
void moveto(int newx,int newy);

};
class circles:point {
private:
int radius;
public:
circles(int initx,int inity,int initradius);
void show();
void hide();
void expand(int expandby);
void moveto(int nx,int ny);
void contract(int contractby);
};

location::location(int initx,int inity)
{ x=initx; y=inity; }
point::point(int initx,int inity):location(