文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 工程科技 > 机械/仪表 > 关于俄罗斯方块的嵌入式设计报告
侵权投诉

关于俄罗斯方块的嵌入式设计报告

{

if (event->timerId() == timer.timerId()) {

if (isWaitingAfterLine) {

isWaitingAfterLine = false;

newPiece();

timer.start(timeoutTime(), this);

} else {

oneLineDown();

}

} else {

QFrame::timerEvent(event);

}

}

void HTetrisBoard::clearBoard()

{

for (int i = 0; i < HTetrisBoardHeight * HTetrisBoardWidth; ++i)

board[i] = HTetrisPieceShapeNone;

}

void HTetrisBoard::dropDown()

{

int dropHeight = 0;

int newY = curY;

while (newY > 0) {

if (!tryMove(curPiece, curX, newY - 1))

break;

--newY;

++dropHeight;

}

pieceDropped(dropHeight);

}

void HTetrisBoard::oneLineDown()

{

if (!tryMove(curPiece, curX, curY - 1))

pieceDropped(0);

}

void HTetrisBoard::pieceDropped(int dropHeight)

{

for (int i = 0; i < 4; ++i) {

int x = curX + curPiece.x(i);

int y = curY - curPiece.y(i);

shapeAt(x, y) = curPiece.shape();

}

exp += 1;

score += dropHeight+1;

emit scoreChanged(score);

removeFullLines();

if(exp%50 == 0){

level++;

timer.start(timeoutTime(), this);

emit levelChanged(level);

}

if (!isWaitingAfterLine)

上一页第16页

TOP相关主题

热门文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email