资源描述:
《俄罗斯方块c 程序(Tetris c program)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、俄罗斯方块c++程序(Tetrisc++program)(1)thefirstcpp:#include"colorConsole.h""HANDLE,initiate(){HANDLEhOutput;HOutput=GetStdHandle(STD_OUTPUT_HANDLE);ReturnhOutput;}BOOL,TextOut(HANDLE,hOutput,int,x,int,y,WORD,wColors[],int,nColors,LPTSTR,lpszString){DWORDcWritten;BOOLfSuccess;COORDcoord;Coord.X=x;//starta
2、tfirstcellCoord.Y=y;//offirstrowFSuccess=WriteConsoleOutputCharacterHOutput,bufferhandle//screenLpszString,tosourcestring//pointerLstrlen(lpszString),ofstring//lengthCoord,celltowriteto//first&cWritten);//actualnumberwrittenIf(...FSuccess)Cout<<"error:WriteConsoleOutputCharacter"<3、ess&&coord.X4、rn0;}(2)secondCPP#include#include#include#include#include#pragmacomment(LIB,winmm.lib)//backgroundmusicfiles#include"colorConsole.h""#include#defineSQUARE_COLORBACKGROUD_BLUE
5、BACKGROUD_RED
6、BACKGROUD_INTENSITY//backgroundcolor#defineSQUARE
7、_COLORFOREGROUND_RED
8、FOREGROUND_GREEN
9、FOREGROUND_INTENSITY//colorbox#defineup72#definedown80#defineleft75#defineright77#defineESC27#defineMAPW15/mapwidth#defineMAPH//25heightmapVoid,initiate1();Int*(build);//create//initializationblockBOOLisavailable(inta[],intx,inty,intw,inth);//determinewhether
10、canletgoVoid,drawblocks(int,a[],int,W,int,h,int,x,int,y,WORD,wColors[],int,nColors);Void(delete_cache);//removekeyboardbufferVoidrevolve(inta[][4],intw,inth,int*x,inty);//rotateblockVoid,pro();Void,end();Void,delete_blocks(int,*a,int,W,int,h,int,x,int,y);Void,gameover();Void,deletefull_line(int,m
11、[][MAPW],int,row,int,W,int,H);//消除一行intdx=30,dy=5;//屏幕上的偏移量intscore=0,level=0;map[int][mapwmaph];inta1[4][4]={{1}}},{1,1,1-trichloroethane;inta2[4][4]={{0,1},{1,1,1-trichloroethane}};inta3[4][4]={{1,1},{0,1,1}};inta4[4