CTO下载-c语言编写俄罗斯方块【DOC精选】.docVIP

  • 3
  • 0
  • 约8.85千字
  • 约 13页
  • 2017-02-16 发布于江苏
  • 举报

CTO下载-c语言编写俄罗斯方块【DOC精选】.doc

CTO下载-c语言编写俄罗斯方块【DOC精选】

#include #include #include #include #include #include #include #define ESC 0x011b #define UP 0x4800 #define DOWN 0x5000 #define LEFT 0x4b00 #define RIGHT 0x4d00 #define SPACE 0x3920 #define Y 0x1579 #define N 0x316e #define clearkbd(); while(bioskey(1)) bioskey(0); /*清空键盘缓冲队列*/ void update(); void messagebox(); void process(); void initremove(); void initinfo(); void initbox(); void initposition(); void next_shape(); typedef struct shape /*形状单一状态的记录*/ { int attr; int co[8]; }shape; typedef struct RE_AB /*相对,绝对坐标记录*/ { int Rx,Ry; int x1,x2,y1,y2; }RE_AB; RE_AB RA; shape p[19]={ { RED,0,1,1,0,1,1,2,1 }, /*数组中保证y最大的在最后,以便initposition使用*/ { RED,0,1,1,0,1,1,1,2 }, { RED,0,0,1,0,2,0,1,1 }, { RED,0,0,0,1,1,1,0,2 }, { GREEN,0,0,1,0,2,0,3,0 }, { GREEN,0,0,0,1,0,2,0,3 }, { CYAN,0,0,0,1,1,0,1,1 }, { BROWN,0,0,1,0,1,1,2,1 }, { BROWN,1,0,0,1,1,1,0,2 }, { BLUE,1,0,2,0,1,1,0,1 }, { BLUE,0,0,0,1,1,1,1,2 }, { MAGENTA,0,0,0,1,0,2,1,2 }, { MAGENTA,2,0,0,1,1,1,2,1}, { MAGENTA,0,0,1,0,1,1,1,2 }, { MAGENTA,0,0,0,1,1,0,2,0 }, { YELLOW,0,2,1,0,1,1,1,2 }, { YELLOW,0,0,1,0,2,0,2,1 }, { YELLOW,1,0,0,0,0,1,0,2}, { YELLOW,0,0,0,1,1,1,2,1 }, }; int nback,nleft,nright,r_f[12][22],rs1,rs2,xcors,xcorb,ycors,ycorb; /*检查方快有没有左,右,下接触,游戏区内所有格子有无颜色记录数组,rs1形状记录,rs2为提示框用,记录小格子在游戏区中的位置,按键存储*/ void interrupt (*oldint)(); /*系统定时中断*/ int count_down=0,count_other=0; /*中断记时*/ void interrupt newint() /*设置新的中断程序*/ { count_down++; count_other++; oldint(); } void intenable() /*设置中断向量表,启动新的中断程序*/ { oldint=getvect(0x1c); disable(); setvect(0x1c,newint); enable(); } void intrestore() /*恢复中断向量*/ { disable(); setvect(0x1c,oldint); enable(); } void HZ12(int x0,int y0,int w,int color,char *s) /*根据字模,在dos下显示汉字*/ /*横坐标,纵坐标,字间隔,汉字颜色,汉字字符串*/ { FILE *fp; register char buffer[24]; register char str[2]; unsigned long fpos;/*fpos为最终偏移动量*/ register int i,j,k; fp=fopen(hzk12,r);/*打开12*12汉字苦*/ while(*s)/*一直到字符串结束为止*/ { if(*s0)/*汉字输出*/ { str[0]=(*s)-0xa0; str[1]=*(s+1)-0xa0; fpos=((str[0]-1)*94+(str[1]-1))*24L;/*计算汉字在hzk12

文档评论(0)

1亿VIP精品文档

相关文档