- 3
- 0
- 约1.14万字
- 约 16页
- 2016-09-25 发布于湖北
- 举报
#include graphics.h #include stdio.h #include dos.h #include conio.h #include time.h #include math.h #include stdlib.h /*定义左上角点在屏幕上的位置*/ #define MAPXOFT 9 #define MAPYOFT 5 /*定义下一个方块显示的位置*/ #define MAPXOFT1 13 #define MAPYOFT1 -2 #define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 /*此键为加速键*/ #define UP 0x4800 /*此键为变形键*/ #define ESC 0x011b /*此键为退出键*/ #define ENTER 0x1c0d #define TIMER 0x1c /* 时钟中断的中断号 */ /* 中断处理函数在C和C++中的表示略有不同。 如果定义了_cplusplus则表示在C++环境下,否则是在C环境下。 */ #ifdef __cplusplus #define __CPPARGS ... #else #define __CPPARGS #endif int TimerCounter=0; /* 计时变量,每秒钟增加18。 */ /* 指向原来时钟中断处理过程入口的中断处理函数指针(句柄) */ void interrupt ( *oldhandler)(__CPPARGS); /* 新的时钟中断处理函数 */ void interrupt newhandler(__CPPARGS) { /* increase the global counter */ TimerCounter++; /* call the old routine */ oldhandler(); } /* 设置新的时钟中断处理过程 */ void SetTimer(void interrupt (*IntProc)(__CPPARGS)) { oldhandler=getvect(TIMER); disable(); /* 设置新的时钟中断处理过程时,禁止所有中断 */ setvect(TIMER,IntProc); enable(); /* 开启中断 */ } /* 恢复原有的时钟中断处理过程 */ void KillTimer() { disable(); setvect(TIMER,oldhandler); enable(); } struct shape { int xy[8],next; }; struct shape shapes[19]= { /*x1,y1,x2,y2,x3,y3,x4,y4 指四个小方块的相对坐标,next指此方块变形后应变为哪个小方块 { x1,y1,x2,y2,x3,y3,x4,y4,next}*/ { 0,-2, 0,-1, 0, 0, 1, 0, 1}, {-1, 0, 0, 0, 1,-1, 1, 0, 2}, { 0,-2, 1,-2, 1,-1, 1, 0, 3}, {-1,-1,-1, 0, 0,-1, 1,-1, 0}, { 0,-2, 0,-1, 0, 0, 1,-2, 5}, {-1,-1, 0,-1, 1,-1, 1, 0, 6}, { 0, 0, 1,-2, 1,-1, 1, 0, 7}, {-1,-1,-1, 0, 0, 0, 1, 0, 4}, {-1, 0, 0,-1, 0, 0, 1, 0, 9}, { 0,-2, 0,-1, 0, 0, 1,-1,10}, {-1,-1, 0,-1, 1,-1, 0, 0,11}, { 0,-1, 1,-2, 1,-1, 1, 0, 8}, {-1, 0, 0,-1, 0, 0, 1,-1,13}, { 0,-2, 0,-1, 1,-1, 1, 0,12}, {-1,-1, 0,-1, 0, 0, 1, 0,15}, { 0,-1, 0, 0, 1,-2, 1,-1,14}, { 0,-3, 0,-2, 0,-1, 0, 0,17}, {-1, 0, 0, 0, 1, 0, 2, 0,16}, { 0,-1, 0, 0, 1,-1, 1, 0,18} }; int board[10][20]={0};/*定义游戏板初始化为0*/ char sp[]=0,le[]=0,sc[]=00000; int speed,speed
您可能关注的文档
最近下载
- 《岭外代答》的人类学解读实验——兼论宋代华夷之辨的弱化.pdf VIP
- QSH 0081-2007 探井(直井)钻井工程设计.docx VIP
- 《岭表录异》青少年读物.pdf VIP
- 资产处置委托协议书模板5篇.docx VIP
- mipi_CSI-2_specification_v1.3._高清版电子文档.pdf VIP
- QSH 0042-2007 钻井液用磺甲基酚醛树脂技术要求.docx VIP
- 《QSH0047-2007-钻井液用抗高温抗盐降滤失剂通用技术要求》.pdf VIP
- 股市主力操盘盘 口摩斯密码(原创内容,侵权必究).pptx
- 指数基金投资指南(银行螺丝钉).pdf VIP
- 《QSH0082-2007-水平井钻井工程设计要求》.pdf VIP
原创力文档

文档评论(0)