1 / 21
文档名称:

俄罗斯方块游戏.doc

格式:doc   页数:21页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

俄罗斯方块游戏.doc

上传人:xxj16588 2016/6/6 文件大小:0 KB

下载得到文件列表

俄罗斯方块游戏.doc

文档介绍

文档介绍:俄罗斯方块游戏/********************************/ /* Desc: 俄罗斯方块游戏*/ /* By: hoodlum1980 */ /* Email: jinfd@ */ /* Date: 22: 30 */ /********************************/ #include <> #include <> #include <> #include <> #include <> #include <> #define true 1 #define false 0 #define BoardWidth 12 #define BoardHeight 23 #define _INNER_HELPER /*inner helper method */ /*Scan Codes Define*/ enum KEYCODES { K_ESC =0x011b, K_UP =0x4800, /* upward arrow */ K_LEFT =0x4b00, K_DOWN =0x5000, K_RIGHT =0x4d00, K_SPACE =0x3920, K_P =0x1970 }; /* the data structure of the block */ typedef struct tagBlock { char c[4][4]; /* cell fill info array, 0-empty, 1-filled */ int x; /* block position cx[ 0,BoardWidht -1] */ int y; /* block position cy [-4,BoardHeight-1] */ char color; /* block color */ char size; /* block max size in width or height */ char name; /* block name (the block's shape) */ } Block; /* game's global info */ int FrameTime= 1300; int CellSize= 18; int BoardLeft= 30; int BoardTop= 30; /* next block grid */ int NBBoardLeft= 300; int NBBoardTop= 30; int NBCellSize= 10; /* score board position */ int ScoreBoardLeft= 300; int ScoreBoardTop=100; int ScoreBoardWidth=200; int ScoreBoardHeight=35; int ScoreColor=LIGHTCYAN; /* infor text postion */ int InfoLeft=300; int InfoTop=200; int InfoColor=YELLOW; int BorderColor=DARKGRAY; int BkGndColor=BLACK; int GameRunning=true; int TopLine=BoardHeight-1; /* top empty line */ int TotalScore=100; char info_score[20]; char info_help[255]; char mon[255]; /* our board, Board[x][y][0]-isFilled, Board[x][y][1]-fillColor */ unsigned char Board[BoardWidth][BoardHeight][2]; char BufferCells[4][4]; /* used to judge if can rotate block */ Block curBlock; /* current moving block */ Block nextBlock; /* next Block to appear */ /* function list */ int GetKeyCode(); int CanMove(int dx,int dy); int CanRotate(); int RotateBlock(Block *block); int MoveBlock(Block *block,int dx,int dy); void DrawBlock(Block *block,