c++俄罗斯方块代码

c++俄罗斯方块代码

ID:8462212

大小:68.87 KB

页数:55页

时间:2018-03-28

c++俄罗斯方块代码_第1页
c++俄罗斯方块代码_第2页
c++俄罗斯方块代码_第3页
c++俄罗斯方块代码_第4页
c++俄罗斯方块代码_第5页
资源描述:

《c++俄罗斯方块代码》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、Block.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Drawing;usingSystem.Windows.Forms;namespaceTetris{///

///砖Á?块¨¦的Ì?类¤¨¤///classBlock{protectedPoint[]structArr;//储ä¡é存ä?砖Á?块¨¦组Á¨¦成¨¦信?息

2、¡é的Ì?坐Á?标À¨º数ºy组Á¨¦protectedint_xPos;//研D究?砖Á?块¨¦顶£¤点Ì?所¨´在¨²游®?戏¡¤界?面?的Ì?x坐Á?标À¨ºprotectedint_yPos;//研D究?砖Á?块¨¦顶£¤点Ì?所¨´在¨²游®?戏¡¤界?面?的Ì?y坐Á?标À¨ºprotectedColor_blockColor;//砖Á?块¨¦的Ì?颜?色¦?protectedColor_disapperColor;//擦¨¢出?颜?色¦?protectedintrectPix;//每

3、?个?单Ì£¤元a格?的Ì?像?素?publicBlock()//默?认¨?构1造¨¬函¡¥数ºy,ê?声¦¨´明¡Â此ä?函¡¥数ºy是º?为a了¢?子Á¨®类¤¨¤能¨¹顺3利¤?创ä¡ä建¡§{}///

Block类¤¨¤的Ì?构1造¨¬函¡¥数ºy的Ì?介¨¦绍¦¨¹///Block类¤¨¤的Ì?构1造¨¬函¡¥数ºy//////储ä¡é存ä?砖Á?块¨¦各¡Â点Ì?的Ì?Point类¤¨¤///

4、mname="bColor">砖Á?块¨¦颜?色¦?///擦¨¢出?颜?色¦?///砖Á?块¨¦像?素?publicBlock(Point[]sa,ColorbColor,ColordColor,intpix){_blockColor=bColor;_disapperColor=dColor;rectPix=pix;structArr=sa;}publicPointthis[i

5、ntindex]{get{returnstructArr[index];}}#region成¨¦员¡À变À?量¢?相¨¤应®

6、属º?性?publicintLengce{get{returnstructArr.Length;}}publicintxPos{get{return_xPos;}set{_xPos=value;}}publicintyPos{get{return_yPos;}set{_yPos=value;}}publicColorBlockColor{get{return_blockCo

7、lor;}}#endregionpublicvoidDeasilRotate()//顺3时º¡À针?旋y转Áa{inttemp;for(inti=0;i

8、+i){temp=structArr[i].X;structArr[i].X=-structArr[i].Y;structArr[i].Y=temp;}}privateRectanglePointToRect(Pointp){returnnewRectangle((_xPos+p.X)*rectPix+1,(_yPos-p.Y)*rectPix+1,rectPix-2,rectPix-2);}///

///在¨²指?定¡§画-板ã?下?绘?制?砖Á?块¨¦///

9、///一°?个?用®?于®¨²绘?制?的Ì?Graphics对?象¨®publicvirtualvoidPaint(Graphicsgp){SolidBrushsb=newSolidBrush(_blockColor);foreach(PointpinstructArr){lock(gp)//线?程¨¬锁?{gp.FillRectangle(sb,PointToRect(p));}}}publicvoiderase(Graphicsg

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。