資源簡介
Qt打磚塊游戲,原創(chuàng)。游戲分為邏輯處理部分和GUI部分,磚塊產(chǎn)生隨機顏色。并且,游戲可設置關卡。

代碼片段和文件信息
#include?“ball.h“
Ball::Ball(?qreal?x?qreal?y?qreal?radius?QColor?ballColor?)
{
????dirX?=?1.0;
????dirY?=?-1.0;
????speed?=?1.0;
????
????shape?=?new?QRectF(?x?y?radius?radius?);
????color?=?ballColor;
}
Ball::~Ball()
{
????delete?shape;
}
void?Ball::setShape(?const?QRectF?&newShape?)
{
????shape->setRect(?newShape.left()?newShape.top()
????newShape.width()?newShape.height()?);
}
void?Ball::setColor(?const?QColor?&newColor?)
{
????color?=?newColor;
}
void?Ball::setDirX(?qreal?newDirX?)
{
????dirX?=?newDirX;
}
void?Ball::setDirY(?qreal?newDirY?)
{
????dirY?=?newDirY;
}
QRectF?Ball::getShape()?const
{
????return?QRectF(?shape->left()?shape->top()
??shape->width()?shape->height()?);
}
QColor?Ball::getColor()?const
{
????return?color;
}
qreal?Ball::getDirX()?const
{
????return?dirX;
}
qreal?Ball::getDirY()?const
{
????return?dirY;
}
void?Ball::move()
{
????shape->setLeft(?shape->left()?+?dirX?);
????shape->setRight(?shape->right()?+?dirX?);
????shape->setTop(?shape->top()?+?dirY?);
????shape->setBottom(?shape->bottom()?+?dirY?);
}
void?Ball::setSpeed(?qreal?newSpeed?)
{
????speed?=?newSpeed;
????setDirX(?speed?);
????setDirY(?-speed?);
}
qreal?Ball::getSpeed()?const
{
????return?speed;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????107520??2012-01-09?16:18??Qt打磚塊游戲\bin\libgcc_s_dw2-1.dll
?????文件??????11362??2009-01-11?02:32??Qt打磚塊游戲\bin\mingwm10.dll
?????文件????2892800??2013-11-05?00:16??Qt打磚塊游戲\bin\QtCore4.dll
?????文件???10153984??2012-11-26?16:46??Qt打磚塊游戲\bin\QtGui4.dll
?????文件?????241664??2014-04-06?11:24??Qt打磚塊游戲\bin\打磚塊.exe
?????文件?????372795??2014-04-06?11:40??Qt打磚塊游戲\document\Qt打磚塊游戲.pdf
?????文件??????57758??2014-04-05?22:11??Qt打磚塊游戲\LaTex\game.png
?????文件??????30723??2014-04-06?11:40??Qt打磚塊游戲\LaTex\未命名-3.tex
?????文件???????1234??2014-04-05?19:39??Qt打磚塊游戲\sources\ball.cpp
?????文件????????620??2014-04-05?19:36??Qt打磚塊游戲\sources\ball.h
?????文件????????615??2014-04-05?12:58??Qt打磚塊游戲\sources\brick.cpp
?????文件????????370??2014-04-05?12:58??Qt打磚塊游戲\sources\brick.h
?????文件???????5752??2014-04-06?11:23??Qt打磚塊游戲\sources\game.cpp
?????文件???????1076??2014-04-06?11:22??Qt打磚塊游戲\sources\game.h
?????文件??????99678??2014-04-05?15:31??Qt打磚塊游戲\sources\game.ico
?????文件????????498??2014-04-05?15:33??Qt打磚塊游戲\sources\game.pro
?????文件?????????37??2014-04-05?15:32??Qt打磚塊游戲\sources\game.rc
?????文件???????5404??2014-04-06?11:24??Qt打磚塊游戲\sources\gamewindow.cpp
?????文件????????973??2014-04-05?21:52??Qt打磚塊游戲\sources\gamewindow.h
?????文件???????4936??2014-04-05?15:25??Qt打磚塊游戲\sources\game_zh_CN.ts
?????文件???????8592??2013-12-31?23:56??Qt打磚塊游戲\sources\images\about.png
?????文件???????2799??2013-04-28?04:58??Qt打磚塊游戲\sources\images\changecolor.png
?????文件???????5912??2013-12-31?23:56??Qt打磚塊游戲\sources\images\exit.png
?????文件???????5082??2013-12-31?23:56??Qt打磚塊游戲\sources\images\game.png
?????文件???????3945??2013-09-08?04:34??Qt打磚塊游戲\sources\images\newgame.png
?????文件??????11044??2013-12-31?23:56??Qt打磚塊游戲\sources\images\start.png
?????文件??????10454??2013-12-31?23:56??Qt打磚塊游戲\sources\images\stop.png
?????文件????????341??2014-04-05?22:34??Qt打磚塊游戲\sources\images.qrc
?????文件???????1902??2014-04-05?15:25??Qt打磚塊游戲\sources\language\game_zh_CN.qm
?????文件????????344??2014-04-05?22:32??Qt打磚塊游戲\sources\main.cpp
............此處省略12個文件信息
評論
共有 條評論