C写的俄罗斯方块源代码开发文档
0 20 40 60 20 40 60 每一点取的是左上角坐标 20,60, 20,40, 20,20, 40,60, RED, 1, 0,60, 20,60, 40,40, 40,60, RED, 2, 20,20, 40,20, 40,40, 40,60, RED, 3, 0,60, 0,40, 20,40, 40,40, RED, 0, 20,60, 20,40, 20,20, 40,20, YELLOW,1, 0,40, 0,60, 20,60, 40,60, YELLOW,2, 20,60, 40,60, 40,40, 40,20, YELLOW,3, 0,40, 20,40, 40,40, 40,60, YELLOW,0, 0,60, 20,60, 20,40, 40,60, GREEN,1, 0,40, 20,60, 20,40, 20,20, GREEN,2, 0,40, 20,40, 20,60, 40,40, GREEN,3, 20,20, 20,40, 20,60, 40,40, GREEN,0, 0,60, 20,60, 20,40, 40,40, WHITE,1, 0,40, 0,20, 20,40, 20,60, WHITE,0, 20,0, 20,20, 20,40, 20,60, LIGHTGRAY,1, 0,40, 20,40, 40,40, 60,40, LIGHTGRAY,0, 20,20, 20,40, 20,60, 20,80, LIGHTGRAY,1, 0,60, 20,60, 40,60, 60,60, LIGHTGRAY,0, 20,40, 20,60, 40,40, 40,60, LIGHTGREEN,1以下是源代码:Game.h 文件#include <graphics.h>#include <conio.h>#include <cmath>#include <time.h>#define UP 'w'#define DOWN 's'#define LEFT 'a'#define RIGHT 'd'#define Esc 27int key=NULL;int a=0;struct Shapeint xy8; int color;struct full /记?录?每?个?方¤?块¨¦的Ì?信?息¡é bool isfull;int color;Shape shape74= /7种?基¨´本À?形?状Á¡ä 四?种?变À?形?(ꡧ不?够?四?种?变À?化¡¥的Ì?用®?相¨¤同ª?的Ì?来¤¡ä填¬?充?)ê? 20,60, 20,40, 20,20, 40,60, RED, 0,60, 20,60, 40,40, 40,60, RED, 20,20, 40,20, 40,40, 40,60, RED, 0,60, 0,40, 20,40, 40,40, RED, 20,60, 20,40, 20,20, 40,20, YELLOW, 0,40, 0,60, 20,60, 40,60, YELLOW, 20,60, 40,60, 40,40, 40,20, YELLOW, 0,40, 20,40, 40,40, 40,60, YELLOW, , 0,60, 20,60, 20,40, 40,60, GREEN, 0,40, 20,60, 20,40, 20,20, GREEN, 0,40, 20,40, 20,60, 40,40, GREEN, 20,20, 20,40, 20,60, 40,40, GREEN, , 0,60, 20,60, 20,40, 40,40, WHITE, 0,40, 0,20, 20,40, 20,60, WHITE, 0,60, 20,60, 20,40, 40,40, WHITE, 0,40, 0,20, 20,40, 20,60, WHITE , 0,40, 20,40, 20,60, 40,60 , BLUE, 0,40, 0,60, 20,40, 20,20 , BLUE, 0,40, 20,40, 20,60, 40,60 , BLUE, 0,40, 0,60, 20,40, 20,20 , BLUE, 20,0, 20,20, 20,40, 20,60, LIGHTGRAY, 0,40, 20,40, 40,40, 60,40, LIGHTGRAY, 20,0, 20,20, 20,40, 20,60, LIGHTGRAY, 0,40, 20,40, 40,40, 60,40, LIGHTGRAY, 20,40, 20,60, 40,40, 40,60, LIGHTGREEN, 20,40, 20,60, 40,40, 40,60, LIGHTGREEN, 20,40, 20,60, 40,40, 40,60, LIGHTGREEN, 20,40, 20,60, 40,40, 40,60, LIGHTGREEN, ;class Gameint x,y; /x y 表À¨ª示º?方¤?块¨¦的Ì?相¨¤对?坐Á?标À¨ºint dir; /方¤?块¨¦移°?动¡¥方¤?向¨°int _shape; /七?种?形?状Á¡äint change_shape; /四?种?变À?换?int old_shape; /记?录?未¡ä变À?形?方¤?块¨¦的Ì?形?状Á¡äint old_change_shape;bool is_fullline20; /标À¨º记?是º?否¤?满¨²行Dfull isfull2010; /标À¨º记?是º?否¤?有®D方¤?块¨¦ 20行D10列¢D public :Game();int shapeX(int i)return (shape_shapechange_shape.xyi+x); /返¤¦Ì回?shape形?状Á¡ä第̨²i个?方¤?块¨¦的Ì?的Ì?实º¦Ì际¨ºX坐Á?标À¨ºint shapeY(int i)return (shape_shapechange_shape.xyi+1+y); /返¤¦Ì回?shape形?状Á¡ä第̨²i个?方¤?块¨¦的Ì?的Ì?实º¦Ì际¨ºY坐Á?标À¨ºint rowX(int i)return i*20+100; /返¤¦Ì回?第̨²i列¢D的Ì?X坐Á?标À¨ºint columnY(int i)return i*20+50; /返¤¦Ì回?第̨²i行D的Ì?Y坐Á?标À¨ºvoid drawinterface(); /画-界?面?void drawshape(); /画-方¤?块¨¦void clearshape(); /清?除y方¤?块¨¦void drawshowshape( ); /画-在¨²预¡è览¤¨¤框¨°中D的Ì?方¤?块¨¦void clearshowshape(); /清?除y在¨²预¡è览¤¨¤框¨°中D的Ì?方¤?块¨¦void getdir(); /取¨?得Ì?方¤?块¨¦移°?动¡¥方¤?向¨°bool is_move_leftX(); /方¤?块¨¦是º?否¤?能¨¹向¨°左Á¨®移°?bool is_move_rightX(); /方¤?块¨¦是º?否¤?能¨¹向¨°右®¨°移°?bool is_moveY(); /方¤?块¨¦是º?否¤?能¨¹在¨² Y 轴¨¢方¤?向¨°移°?动¡¥bool is_change(); /是º?否¤?能¨¹变À?形? (ꡧ近¨¹边À?界?时º¡À变À?形?后¨®不?能¨¹出?界?)ê?void shapemove(); /方¤?块¨¦移°?动¡¥void newshape(); /出?新?的Ì?方¤?块¨¦ void fullline(); /扫¦¡§描¨¨满¨²行Dvoid clearfullline(); /清?除y满¨²行Dvoid repaint(); /重?画-(ꡧ实º¦Ì现?消?行D下?移°?)ê?bool isgameover(); /游®?戏¡¤是º?否¤?结¨¢束º?;Game:Game