Пример #1
0
void display(void) {
    glClear(GL_COLOR_BUFFER_BIT);
    glPushMatrix();

    // Wind
    wind.draw();

    // Wires
    w[0].draw();
    w[1].draw();
    w[2].draw();

    // Air duct
    glColor3f WHITE;
    glLine(ADOffset, ADOffset, WIDTH - ADOffset, ADOffset);
    glLine(ADOffset, ADOffset + ADHeight, WIDTH - ADOffset, ADOffset + ADHeight);

    // Air sensor - controller connection
    TT_TIC.draw();

    // Air temperature sensor
    TT.draw();

    // Controller
    TIC.draw();

    // Air turbine
    glColor3f WHITE;
    turbine.draw();

    // Boiler_Wind pipe
    boiler_wind[0].draw();
    boiler_wind[1].draw();
    boiler_wind[2].draw();
    boiler_wind[3].draw();

    // Pressure Release Pipe
    boiler_.draw();

    // Pressure Valve;
    pressureValve.draw();

    // Boiler
    boiler.draw();

    // Pressure Indicator
    PrI.draw();

    // Oil Valve
    oilValve.draw();

    glPopMatrix();
    glutSwapBuffers();
}
Пример #2
0
int glArc(GLContext *ctx, GLPoints *pts, int cx, int cy, int w, int h, int s, int e, int range_check)
{
    int i, p_i = 0;
    int lx = 0, ly = 0;
    while (e < s)
    {
        e += 360;
    }

    for (i = s; (i <= e); i++)
    {
        int x, y;
        x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
        y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
        if (i != s) {

            if(glAbs(x-lx) == 1 && glAbs(y-ly) == 1) {

                if(lx >= ctx->clip_x1 && ly >= ctx->clip_y1 && lx < ctx->clip_x2 && ly < ctx->clip_y2) {
                    glPointsPut(pts, lx, ly);
                    p_i++;
                }

            } else {
                p_i += glLine(ctx, pts, lx, ly, x, y, range_check);
            }

        }

        lx = x;
        ly = y;
    }

    return p_i;
}
Пример #3
0
static int NDS_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points,
							   int count)
{
    NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata;
	int i;
	int color = RGB15(renderer->r >> 3,
					  renderer->g >> 3,
					  renderer->b >> 3);

	for (i=0; i < count-1; i++) {
		if (data->is_sub) {
			glLine(points[i].x, points[i].y, points[i+1].x, points[i+1].y, color);
		} else {
			glLine(points[i].x, points[i].y - SCREEN_HEIGHT, 
				   points[i+1].x, points[i+1].y - SCREEN_HEIGHT, color);
		}
	}

	return 0;
}
Пример #4
0
void eloop(){
	if(Btop>B||Etop>E)marke();
	for(bxy*b=B;b<Btop;b++){
		if(0)killb:if(killb(b))break;
		float bx=b->x,by=b->y;
		b->x+=b->xd;
		b->y+=b->yd;
		if(b->y<0||b->x<0||b->x>128||b->y>256)goto killb;
		if(T==MT){
			glLine(bx,by,b->x,b->y);
			glRect(b->x-1,b->y-1,b->x+1,b->y+1);
		}
		for(int i=0;i<2;i++)
			if(btop(i,b)<256){
				if(Php[i]!=b->p){
					Ph[i]--;
					Php[i]=b->p;
				}
				goto killb;
			}
	}
	for(obje*e=E;e<Etop;e++){
		if(0)kille:if(kille(e))break;
		float x=e->x,y=e->y,r;
		int et=!!(e->t&128);
		switch(e->t&127){
		case(CAN)
			e->x=x+=e->xd;
			e->y=y+=e->yd;
			et=nerdest(e);
			erotxy(e,Px[et],Py[et],M_PI/16);
			if(!(T-e->c&3))
				mkbd(e->c,x+cos(e->d)*r*2,y+sin(e->d)*r*2,6,e->d);
			if(x<-5||x>133||y<-5||y>261||e->h<1)goto kille;
			else(e->h<4||rdmg(x,y,e->h*3/2)){
				deceh(e);
			}
			if(T==MT){
				float r=min(T-e->c,e->h);
				glColor(wht);
				glLine(x,y,x+cos(e->d)*r*2,y+sin(e->d)*r*2);
				glColor(red+et);
				glCirc(x,y,r);
			}
		case(TAR)
			r=min(T-e->c,abs(e->h));
			et=e->h<6?4:rdmg(x,y,r);
			if(et)
				seteh(e,e->h-et);
			setexdyd(e,rrotxy(e->xd,x,y,Px[0],Py[0],M_PI/72),rrotxy(e->yd,x,y,Px[1],Py[1],M_PI/72));
			if(e->h<-120)goto kille;
			if(T==MT){
				glColor(wht);
				glCirc(x,y,r);
				rndcol();
				glCirc(x,y,min(r,24));
				glColor(wht);
				glCirc(x,y,min(r,16));
				rndcol();
				glCirc(x,y,min(r,8));
			}
			for(int i=0;i<2;i++)
				xLz(min(T-e->c,127+e->h),x,y,i?e->yd:e->xd);
		case(ROT)
			e->x=x+=e->xd;
			e->y=y+=e->yd;
			e->d+=M_PI/(et?128:-128);
			for(int i=0;i<3;i++)
				mkbd(e->c,x+cos(e->d+i*M_PI*2/3)*32,y+sin(e->d+i*M_PI*2/3)*32,8,e->d+i*M_PI*2/3);
			if(x<-5||x>133||y<-5||y>261||e->h<1)goto kille;
			else(e->h<8||rdmg(x,y,e->h)){
				deceh(e);
			}
			if(T==MT){
				rndcol();
				glCirc(x,y,e->h);
				glColor(wht);
				for(int i=0;i<3;i++)
					glLine(x+cos(e->d+i*M_PI*2/3)*(32-e->h*3),y+sin(e->d+i*M_PI*2/3)*(32-e->h*3),x+cos(e->d+i*M_PI*2/3)*32,y+sin(e->d+i*M_PI*2/3)*32);
			}
		case(DOG)
			et=nearest(e);
			if(dst2(x,y,Px[et],Py[et])<64){
				setPx(et,e->x);
				setPy(et,e->y);
			}else{
				erotxy(e,Px[et],Py[et],M_PI/32);
				setexy(e,x+=cos(e->d)*e->xd,y+=sin(e->d)*e->xd);
				et=2;
			}
			if(rdmg2(x,y,16)&(et==2?0xFFFF:et==1?0x00FF:0xFF00)){
				deceh(e);
				if(!e->h)goto kille;
			}
			if(T==MT){
				glColor(et==2?wht:red+et);
				glCirc(x,y,min(e->h,T-e->c));
			}
		case(POO)
			et=nearest(e);
			erotxy(e,Px[et],Py[et],M_PI/48);
			setexy(e,x+=cos(e->d)*e->xd,y+=sin(e->d)*e->xd);
			if(!(T-e->c&7))
				mkbd(e->c,x,y,0,0);
			if(T==MT){
				rndcol();
				glCirc(x,y,min(T-e->c,e->h)/2);
			}
			if(dst2(x,y,Px[et],Py[et])<sqr(e->h)||e->h<16){
				deceh(e);
				if(!e->h)goto kille;
			}
		case(B1)
			if(y<64){
				add2ey(e);
				y+=2;
			}
			mkbxy(e->c,x,y,Px[0],Py[0],4);
			mkbxy(e->c+1,x,y,Px[1],Py[1],4);
			mkbxy(e->c+2,x,y,Px[!(e->h&8)],Py[!(e->h&8)],1);
			et=rdmg2(x,y,e->h);
			if((e->h&7)!=7&&getb(et,e->h&8))
				seteh(e,e->h+1);
			else(getb(et,!(e->h&8))||e->h<7){
				deceh(e);
				if(!e->h)goto kille;
			}