资源描述:
《俄罗斯方块-free(tetris -free)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、俄罗斯方块-free(Tetris-free)/*C-Free,byVC6throughwithout(free.bmpversion).#include#include#include#defineW14/gameareawidth#defineH26/gameareaheight#defineW16/rightstatusbarwidth#defineBSIZE25/gamegridlengthTheordinate#defineY16//setthephoto
2、#defineY212/scoreshurdletopordinate#defineY3//15leveldisplaybartopordinate#defineY421bartopordinate//help#defineCur_xW/2-1//theinitialstateoftheupperleftcornerofthegameboxabscissa#defineCur_y//1initialstateoftheupperleftcorneroftheordinate#defineBgColorRGB(0xF5,0x
3、F5,0xDC)/Beige#defineFgColorRGB(255153204)//Pink#defineREDRGB(255,0,0)#defineORANGERGB(250128,10)#defineYELLOWRGB(255255,0)#defineGREENRGB(0255,0)#defineCYANRGB(0255255)#defineLIGHT_BLUERGB(0xA6,0xCA,0xF0)/blue#definePURPLERGB(255,0255)#defineMS_NEWBLOCKWM_USER+1/
4、/IDnews,new[box]Intscore=0,level=0,level_step=100;//gradeandeachlevelrequiredscoreisdefinedandinitializedInttop=H-1;//ordinatetopIntx,y;//theabscissaandordinatethecurrentpositionoftheboxInt,cur_boxnum,next_boxnum;//cur_boxnumisthecurrentblocknumber,andnext_boxnumi
5、sthenextblocknumberStructBOARD{IntVaR;//state,1representativeshavebeenoccupiedandunoccupied0representativesIntcolor;//color}board[H][W];//definegameboard,HNStructBLOCK{Inta[4][2];//arraydefinitionboxshapeIntcolor;//colorboxIntnext;//aboxnumber};StructBLOCKblock[19
6、]={//initializeanygamebox{1,1,1,2,1,3,2,3,RED,1},{0,2,1,2,2,2,0,3,RED,2},{0,1,1,1,1,2,1,3,RED,3},{2,1,0,2,1,2,2,2,RED,0},{1,1,1,2,0,3,1,3,ORANGE,5},{0,1,0,2,1,2,2,2,ORANGE,6},{1,1,2,1,1,2,1,3,ORANGE,7},{0,2,1,2,2,2,2,3,ORANGE,4},{1,1,0,2,1,2,2,2,YELLOW,9},{1,1,1,2
7、,2,2,1,3,YELLOW,10},{0,2,1,2,2,2,1,3,YELLOW,11},{1,1,0,2,1,2,1,3,YELLOW,8},{1,1,1,2,2,2,2,3,GREEN,13},{1,2,2,2,0,3,1,3,GREEN,12},{2,1,1,2,2,2,1,3,CYAN,15},{0,2,1,2,1,3,2,3,CYAN,14},{1,0,1,1,1,2,1,3,LIGHT_BLUE,17},{0,2,1,2,2,2,3,2,LIGHT_BLUE,16},{1,1,2,1,1,2,2,2,PU
8、RPLE,18},};VoidPaint(HDCHDC,HPENHPEN)//thisfunctionisusedtoinitializetheinterface{Int,I,j;HPENhpen1;//definebrush,usedtodrawadividinglineHBRUSHhbrush=Cr