void inimigo(int x, int y) { setcolor(LIGHTRED); setfillstyle(1,LIGHTRED); rectangle(x-7,y-2,x+7,y); line(x-2,y+1,x,y+10); line(x+2,y+1,x,y+10); line(x-2,y-2,x-3,y-5); line(x+2,y-2,x+3,y-5); floodfill(x,y-1,LIGHTRED); floodfill(x,y+5,LIGHTRED); }
void enemy_car1(int x1, int y1) { p=-400; while(p<=480) { setcolor(13); setfillstyle(9,13); rectangle(480,p+y1,490,p+50+y1); floodfill(482,p+48+y1,13); p+=100; } p=-400; while(p<=480) { setcolor(9); setfillstyle(9,9); rectangle(100,p+y1,110,p+50+y1); floodfill(102,p+y1+48,9); p+=100; } }
void run_info(int pr, int crct, int w, int crtn){ /* pr= pressed, crct= correct, w= wrong , crtn= correction */ setfillstyle(1,15); bar(582,130,609,200); show_number(pr,584,130,4,0,1); show_number(crct,584,150,4,0,1); show_number(w,584,170,4,0,1); show_number(crtn,584,190,4,0,1); }
main() { igraph(); maxx = getmaxx(); maxy = getmaxy(); setcolor(2); bezier(0.85,0.75,0.57,0.78,0.534,0.9,4); setfillstyle(2,2); getch(); closegraph(); return(0); }
void snake(int x1,int y1,int x2,int y2) { setlinestyle(3,0,3); setcolor(GREEN); line(x1,y1,x2,y2); //setcolor(8); setfillstyle(1,GREEN); fillellipse(x1,y1,4,4); for(int i=-2;i<3;i++) for(int j=-2;j<3;j++) putpixel(x2+i,y2+j,GREEN); }
void drawgrid() { if(selectedwindow()==3) { hidemouse(); //setcolor(15); int x1,x2,y1,y2; for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(graph[loopx][loopy]==16) { setfillstyle(1,7); bar(x1,y1,x2,y2); setcolor(8); line(x1,y1,x2,y2); line(x1,y2,x2,y1); } else { setfillstyle(1,graph[loopx][loopy]); bar(x1,y1,x2,y2); } setcolor(0); rectangle(x1,y1,x2+1,y2+1); } } thumb(); showmouse(); } }
void FuelProducer() { HANDLE chan; LongMsg m; unsigned long foo; chan = CreateNamedPipe("\\\\.\\pipe\\lab2p", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 1, sizeof(m), 4, 0, 0); ConnectNamedPipe(chan, 0); randomize(); int valStep = 20; int valBotXCoord = 200; while (1) { int volumeVal = random(9) + 1; int delayVal = volumeVal * 50; int valTopXCoord = (valBotXCoord - valStep * volumeVal); for (int i = valBotXCoord; i >= valTopXCoord; i -= valStep) { setfillstyle(1, ck); bar(20, i, 60, i + 19); delay(delayVal); } m.cmd = FUEL_READY; TransactNamedPipe(chan, &m, sizeof(m), &foo, 4, &foo, 0); for (int i = valTopXCoord; i <= valBotXCoord; i += valStep) { setfillstyle(1, cw); bar(20, i, 60, i + 19); delay(150); } m.volume = volumeVal; m.cmd = FUEL_UPLOADED; TransactNamedPipe(chan, &m, sizeof(m), &foo, 4, &foo, 0); } }
int main() { initwindow(1275,700); setfillstyle(1,1); floodfill(100,100,1); setcolor(12); setbkcolor(1); settextstyle(0,0,8); outtextxy(330,160,"WELCOME TO "); outtextxy(140,270,"THE V-PLAY STORE"); setcolor(7); rectangle(140,450,440,550); rectangle(840,450,1140,550); setfillstyle(1,7); floodfill(300,500,7); setfillstyle(1,7); floodfill(950,500,7); settextstyle(0,0,4); setcolor(0); setbkcolor(7); outtextxy(170,480,"Sign Up!"); outtextxy(875,480,"Sign In"); int x = getmaxx( ); int y = getmaxy( ); setmousequeuestatus(WM_LBUTTONDOWN); while(!ismouseclick(WM_LBUTTONDOWN)); { getmouseclick(WM_LBUTTONDOWN,x,y); if((x>840 && x<1140) && (y>450 && y<550)) login(); else if((x>140 && x<440) && (y>450 && y<550)) signup(); } system("pause"); return 0; }
void ClearColor () { setfillstyle(5,15); // body color bar (175,225,225,300); // body setfillstyle(4,15); // hand and foot color bar (164,230,174,250); // left hand bar (226,230,236,250); // right hand bar (164,295,174,315); // left foot bar (226,295,236,315); // right foot setfillstyle(4,15); // hat color fillellipse( 200, 35, 75, 20 ); // hat setfillstyle(8,0); // eyes color fillellipse( 160, 100, 15, 15 ); // eyes fillellipse( 240, 100, 15, 15 ); // eyes setfillstyle(10,15); // nose color fillellipse( 200, 135, 22, 22 ); // nose setfillstyle(8,0); // mouth color fillellipse( 200, 185, 50, 15 ); // mouth }
void table::draw() { setcolor(8); int i; for(i=1;i<tdepth;i++) { line(x1-i,y1-i,x1-i,y2+i); line(x1-i,y1-i,x2+i,y1-i); } setcolor(15); for(i=1;i<tdepth;i++) { line(x2+i,y2+i,x1-i,y2+i); line(x2+i,y2+i,x2+i,y1-i); } setcolor(0); line(x1-tdepth,y1-tdepth,x1,y1); line(x2+tdepth,y1-tdepth,x2,y1); line(x1-tdepth,y2+tdepth,x1,y2); line(x2+tdepth,y2+tdepth,x2,y2); rectangle(x1-tdepth,y1-tdepth,x2+tdepth,y2+tdepth); setfillstyle(1,15); bar(x1,y1,x2,y2); setcolor(0); int xpos=x1,ypos=y1; for(int loop=0;loop<=visiblecolumns;loop++) { line(xpos,y1,xpos,y2); xpos+=colwidth; } for(loop=0;loop<=visiblerows;loop++) { line(x1,ypos,x2,ypos); ypos+=rowwidth; } int x,y; settextjustify(justify,BOTTOM_TEXT); setcolor(0); for(int row=windowposy;row<windowposy+visiblerows;row++) for(int col=windowposx;col<windowposx+visiblecolumns;col++) { x=x1+(col-windowposx+1)*colwidth; y=y1+(row-windowposy+1)*rowwidth; outtextxy(x,y,getcvalue(col,row)); } int srow,scol; srow=selected/COLS; scol=selected%COLS; drawvalue(scol,srow,15,4); }
void clear_teris(TERIS t) { int x, y, i; for(i=0; i<4; i++) { x = X0+(t.x+all_shape[t.shape][t.rotate].p[i].x)*32; y = Y0+(t.y+all_shape[t.shape][t.rotate].p[i].y)*32; setfillstyle(SOLID_FILL, DARKGRAY); bar(x+1, y+1, x+32-1, y+32-1); setcolor(DARKGRAY); rectangle(x, y, x+32, y+32); } }
void win_drawcircle(int i,int j,int fillcolor,int fillstyle) { int a; struct fillsettingstype b; if ((i<N)&&(i>=0)&&(j>=0)&&(j<N)) { a=getcolor(); getfillsettings(&b); setcolor((fillcolor<10)?(fillcolor+1):(fillcolor-1)); line(table[i][j].x-RADIOUS,table[i][j].y,table[i][j].x+RADIOUS,table[i][j].y); line(table[i][j].x,table[i][j].y-RADIOUS,table[i][j].x,table[i][j].y+RADIOUS); setcolor(fillcolor); setfillstyle(fillstyle,fillcolor); circle(table[i][j].x,table[i][j].y,RADIOUS); floodfill(table[i][j].x,table[i][j].y,fillcolor); setcolor(a); setfillstyle(b.pattern,b.color); } else printf("ERROR i=%d j=%d ",i,j); }
void enemy_car_clear1(int x1, int y1) { setcolor(BLACK); p=-400; while(p<=480) { setcolor(BLACK); setfillstyle(1,BLACK); rectangle(480,p+y1,490,p+50+y1); floodfill(481,p+48+y1,BLACK); p+=100; } p=-400; while(p<=480) { setcolor(BLACK); setfillstyle(1,BLACK); rectangle(100,p+y1,110,p+50+y1); floodfill(101,p+48+y1,BLACK); p+=100; } }
void car_clear(int x, int y) { setcolor(BLACK); rectangle(x,y,x+70,y+80); arc(x+35,y+20,30,150,40); line(x+11,y+90,x+59,y+90); line(x+70,y+80,x+59,y+90); line(x,y+80,x+11,y+90); setfillstyle(1,BLACK); floodfill(x+10,y+10,BLACK); // for car body floodfill(x+15,y-10,BLACK); // for car front bonat floodfill(x+35,y+85,BLACK); // for car rear bonat }
status(char *st) { if(strcmp(st,st1)!=0) { setfillstyle(SOLID_FILL,1); bar(0,getmaxy()-15,getmaxx(),getmaxy()); setcolor(14); settextstyle(0,0,1); outtextxy(20,getmaxy()-12,st); strcpy(st1,st); } return 0; }
void drawstack(int x,int y,int size,int color) { int i; setfillstyle(SOLID_FILL,BLACK); bar(x,y,x+100,y+(size+1)*20); setcolor(color); line(x,y,x,y+size*20); line(x+30,y,x+30,y+size*20); for(i=0;i<=size;i++) line(x,y+i*20,x+30,y+i*20); }
void window(int l,int h,int x1,int y1,int col,char *string,int flag) { if((getpixel(x1-l/2+6,y1-h/2+5)!=col)&&flag == 0) {setcolor(7);rectangle(x1-l/2+3,y1-h/2+2,x1+l/2-3,y1+h/2-5); if(col==3||col==6)col =1; setfillstyle(SOLID_FILL,col);floodfill(x1,y1,7);setcolor(8); rectangle(x1-l/2+3,y1-h/2+2,x1+l/2-3,y1+h/2-5); line(x1-l/2+3,y1+h/2-5,x1-l/2,y1+h/2); line(x1+l/2-3,y1+h/2-5,x1+l/2,y1+h/2); line(x1-l/2,y1+h/2,x1-l/2,y1-h/2); line(x1+l/2,y1+h/2,x1+l/2,y1-h/2); line(x1-l/2,y1-h/2,x1+l/2,y1-h/2); setfillstyle(SOLID_FILL,8);floodfill(x1,y1-h/2+1,8); setcolor(7);line(x1-l/2,y1+h/2,x1+l/2,y1+h/2); rectangle(x1-l/2+3,y1-h/2+2,x1+l/2-3,y1+h/2-5); line(x1-l/2+3,y1+h/2-5,x1-l/2,y1+h/2); line(x1+l/2-3,y1+h/2-5,x1+l/2,y1+h/2); setfillstyle(SOLID_FILL,7);floodfill(x1,y1+h/2-1,7); }settextstyle(DEFAULT_FONT,HORIZ_DIR,2);setcolor(10); if((MM.x>x1-l/2+1&&MM.x<x1+l/2-1)&&(MM.y>y1-h/2+1&&MM.y<y1+h/2-1))setcolor(6); outtextxy(x1-(strlen(string)*7.5),y1-9,string); }
void show_page()//显示翻译的页数 { char t1[10],t2[10],t3[]="of",t4[]="page"; setfillstyle(SOLID_FILL,BLACK); bar(700,5,795,26); sprintf(t1,"%d",page); sprintf(t2,"%d",total); outtextxy(700,10,t4); outtextxy(700+strlen(t4)*8+4,10,t1); outtextxy(700+strlen(t4)*8+strlen(t1)*8+8,10,t3); outtextxy(700+strlen(t4)*8+strlen(t1)*8+strlen(t3)*8+12,10,t2); }
void box (int x1,int y1,int x2,int y2,int relleno,int color) {int poly[8]; poly[0]=x1; poly[1]=y1; poly[2]=x2; poly[3]=y1; poly[4]=x2; poly[5]=y2; poly[6]=x1; poly[7]=y2; setfillstyle (relleno,color); fillpoly (4,poly); }
begain()/*游戏开始画面*/ { int i,j; loop: cleardevice(); MouseOn(); MouseSetXY(180,30); MouseX=180; MouseY=30; scorenum=0; setfillstyle(SOLID_FILL,7); bar(190,60,390,290); setfillstyle(SOLID_FILL,8); for(i=100;i<300;i+=20)/*画格子*/ for(j=200;j<400;j+=20) bar(j-8,i+8,j+8,i-8); setcolor(7); setfillstyle(SOLID_FILL,YELLOW);/*画脸*/ fillellipse(290,75,10,10); setcolor(YELLOW); setfillstyle(SOLID_FILL,0); fillellipse(285,75,2,2); fillellipse(295,75,2,2); setcolor(0); bar(287,80,293,81); randomize(); for(i=0;i<10;i++) for(j=0;j<10;j++) { num[i][j]=random(7)+10;/*用10代表地雷算了*/ if(num[i][j]==10) scorenum++; } sprintf(score,"%d",scorenum); setcolor(1); settextstyle(0,0,2); outtextxy(210,70,score); scorenum=100-scorenum;/*为了后面判断胜利*/ return 0; }
void ToolButton::draw() { int c; setcolor(color); rectangle(x1, y1, x2, y2); if (selected) { c = selCol; setfillstyle(SOLID_FILL, selBgCol); } else { c = col; setfillstyle(SOLID_FILL, bgCol); } bar(x1+1, y1+1, x2-1, y2-1); for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) if (imgMatrix[i][j] == 1) putpixel(x1+j+1, y1+i+1, c); }
void pic() {setcolor(1234); outtextxy(50,50,"THIS IS MADE BY SHAKIL(0304003)"); outtextxy(45,60,"IT HAS 5 LAP AND IN EVERY LAP IT HAS 8 EATTING THINGS."); outtextxy(45,70,"like +1,-1,+,-,*,@,0,o"); outtextxy(45,80,"for increase life,discrease life,--- big or small"); outtextxy(45,90,"speed high,boll power,big or small boll."); outtextxy(60,100,"PRESS ENTER....."); circle(250,250,100); setfillstyle(SOLID_FILL,1234); floodfill(250+1,250+1,1234); getch(); }
void drawpixel(int x, int y) { hidemouse(); int x1=windows[3].x1+4+(x*size); int x2=x1+size-1; int y1=windows[3].y1+17+(y*size); int y2=y1+size-1; setfillstyle(1,graph[x][y]); if(graph[x][y]==16) { setfillstyle(1,7); bar(x1,y1,x2,y2); setcolor(8); line(x1,y1,x2,y2); line(x1,y2,x2,y1); } else bar(x1,y1,x2,y2); setcolor(0); rectangle(x1,y1,x2+1,y2+1); thumb(); showmouse(); }
void node::onclick() { setfillstyle(SOLID_FILL,YELLOW); setcolor(RED); hidemouseptr(); bar(1,460,99,478); char *a="node"; outtextxy(20,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); while(flag==1) { getmousepos(); if(button==1&&x<639&&x>0&&y<459&&y>0&&nodenum<30&&(node::check(x,y)==1)) //if you click on workspace { nodenum++; n[nodenum].id=nodenum; // n[nodenum].name n[nodenum].x=x; n[nodenum].y=y; hidemouseptr(); node::display(x,y,nodenum); // a node will be displayed showmouseptr(); break; } if(nodenum>=30||(button==1&&(node::check(x,y)==0)))//if node is present { break; } } setfillstyle(SOLID_FILL,1); setcolor(15); hidemouseptr(); bar(1,460,99,478); outtextxy(20,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); }
void barra_titulo(char* til) { int color_actual,len; len = strlen(til); setcolor(8); rectangle(0,0,639,19); setfillstyle(1,4); floodfill(2,2,8); setcolor(15); imprimir(300-(len*8)/2 ,6,til); }
void dibujaHuesos(int huesos) { String aux; setfillstyle(1, COLOR(79, 182, 225)); setbkcolor(COLOR(79, 182, 225)); setcolor(WHITE); dibujaSprite("hueso.txt", WIDTH-80, -20); sprintf(aux, "%d", huesos); settextstyle(3, HORIZ_DIR, 49); outtextxy(WIDTH-180, 25, aux); }
void Style::normal_fill() { if (npara == 3) { setlinestyle(SOLID_LINE, 0, NORM_WIDTH); setfillstyle(SOLID_FILL, WHITE); if (item) { bar(item->layer->startx + 1, item->layer->starty + 1, item->layer->endx, item->layer->endy); } int centerx, centery, a = parameters[2]; if (item) { centerx = item->layer->startx + parameters[0]; centery = item->layer->starty + parameters[1]; } setcolor(BLACK); if (item) { rectangle(item->layer->startx, item->layer->starty, item->layer->endx, item->layer->endy); } rectangle(centerx - a, centery - a, centerx + a, centery + a); setfillstyle(SOLID_FILL, BLACK); floodfill(centerx, centery, BLACK); circle(centerx, centery - a, a); } }
void lpeople() { int i,xab,xabc; char *s; setcolor(6); setfillstyle(1,10); rectangle(92,133,178,148); floodfill(93,134,6); rectangle(92,160,178,175); floodfill(93,161,6); rectangle(92,219,178,234); floodfill(93,220,6); for(i=0,xab=96,xabc=96;i<10;i++) { if(i<5) { rectangle(xab,182,xab+16,194); floodfill(xab+1,183,6); sprintf(s,"%d",i+1); outtextxy(xab+4,185,s); xab+=16; } if(i>=5) { rectangle(xabc,197,xabc+16,209); floodfill(xabc+1,198,6); sprintf(s,"%d",i+1); outtextxy(xabc+4,200,s); xabc+=16; } } for(i=0,xab=96,xabc=96;i<10;i++) { if(i<5) { rectangle(xab,241,xab+16,253); floodfill(xab+1,242,6); sprintf(s,"%d",i+1); outtextxy(xab+4,243,s); xab+=16; } if(i>=5) { rectangle(xabc,256,xabc+16,268); floodfill(xabc+1,257,6); sprintf(s,"%d",i+1); outtextxy(xabc+4,258,s); xabc+=16; } } }
void Move_chessman(void) { int row=35,column=35,count=0,key=0,flag=1; void far *image1=0,*image2=0; setcolor(WHITE); setfillstyle(SOLID_FILL,WHITE); sector(column,row,0,360,15,15); getimage(50,50,80,80,image); image_null=image; while(key!=27) { key=Getkey(); switch(key) { case 72 : row=Limit(72,row); UP(column,row); Trace(72,row); break; case 80 : row=Limit(80,row); DOWN(column,row); Trace(80,row); break; case 75 : column=Limit(75,column); LIFT(column,row); Trace(75,column); break; case 77 : column=Limit(77,column); RIGHT(column,row); Trace(77,column); break; case 13 : Computer(column,row); Move_chessman(); break; case 27 : END(); break; default : break; } } }
void DrawFrame(HWND Window,int DrawLeft,int DrawTop, int DrawRight,int DrawBottom) { int SaveColor; struct viewporttype TmpViewPort; int Left,Top,Right,Bottom; MouseHidden(); SaveColor=getcolor(); getviewsettings(&TmpViewPort); WindowGetRealRect(Window,&Left,&Top,&Right,&Bottom); DrawLeft+=Left; DrawTop+=Top; DrawRight+=Left; DrawBottom+=Top; setviewport(DrawLeft,DrawTop,DrawRight,DrawBottom,1); Left-=DrawLeft; Top-=DrawTop; Right-=DrawLeft; Bottom-=DrawTop; setfillstyle(1,FRAMEBKCOLOR); bar(Left,Top,Right,Bottom); setcolor(FRAMECOLOR); Left+=2; Top+=2+CHARHEIGHT/2; Right-=2; Bottom-=2; if (Left<=2) Vline3DDown(DrawLeft,DrawTop,DrawRight,DrawBottom,Left,Top,Bottom); if (Right>=Right-Left-3) Vline3DDown(DrawLeft,DrawTop,DrawRight,DrawBottom,Right-1,Top,Bottom); if (Top<=2+CHARHEIGHT/2) Hline3DDown(DrawLeft,DrawTop,DrawRight,DrawBottom,Left+1,Right,Top); if (DrawBottom>=Bottom-Top-3) Hline3DDown(DrawLeft,DrawTop,DrawRight,DrawBottom,Left+2,Right-1,Bottom); ViewportDisplayString(WindowGetTitle(Window),Left+8,Top-CHARHEIGHT/2, FRAMECOLOR,FRAMEBKCOLOR); setviewport(TmpViewPort.left,TmpViewPort.top,TmpViewPort.right, TmpViewPort.bottom,TmpViewPort.clip); setcolor(SaveColor); MouseShow(); return; }