打砖块程序
作者:贾胜华更新时间: 2005-05-12
刚编的一个打砖块程序,有雏形了!这里公布原代码,希望大家一起改进。
请编译前在主目录下建立一个文本文件()内容为:0 0 0 0 0
哈哈
#include<>
#include<>
#include<>
#include<>
union REGS regs;
unsigned int zhuan[5];
int Msinit();
void Setmouse(int left,int right,int top,int buttom);
int Msread(int *xp,int *yp,int *bup);
void Draw(int x,int y,int sizex,int sizey);
main()
{int mode=VGAHI,driver=VGA;
unsigned int l;
int i,gi,gj,j,flag=1;/*i,j是循环变量,flag是标记变量,-1:向x负半轴移动,+1:向x正半轴移动*/
double qx,
qy,k,b=,speech=,x,y;
double r=,bx=,byy=;
double pianx=,piany=,tx=,ty=,jx=,jy=;
int mx=0,my=0,mb,sum;/*sum纪录砖块的数目*/
FILE * p;
if((p = fopen("", "r")) == NULL)
{printf("The file cannot open!\n");
exit(1);}
initgraph(&driver,&mode,"\\tc\\BGI");
Msinit();
Setmouse((int)(pianx+1+bx/2),(int)((tx+jx)*8+pianx-1-bx/2),(int)byy+piany,(int)byy+piany);
star:cleardevice();/*程序重载的介入点*/
sum=0;
qx=+pianx-10;qy=+pianx-10;k=;
setcolor(7);
rectangle((int)(pianx-2),(int)(piany-2),(int)((tx+jx)*8+2+pianx),302+piany);
setcolor(1);
rectangle((int)(pianx-1),(int)(piany-1),(int)((tx+jx)*8+1+pianx),301+piany);
/*读取盘面情况*/
for(i=0;i<5;i++)
fscanf(p,"%x ",&zhuan[i]);
/*画砖块*/
for(i=0;i<5;i++)
{l
=1;
for(j=0;j<16;j++)
{if((zhuan[i]&l)==0)
{Draw((int)((jx+tx)*((16*
打砖块程序 来自淘豆网m.daumloan.com转载请标明出处.