资源简介
Qt打砖块游戏,原创。游戏分为逻辑处理部分和GUI部分,砖块产生随机颜色。并且,游戏可设置关卡。
代码片段和文件信息
#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个文件信息
- 上一篇:数据库 图书管理系统
- 下一篇:CAD图库之二:传统古建筑元素图案
相关资源
- Qt 串口助手增强版带示波器曲线源代
- QT5获取USB设备信息+PID+VID+序列号+热插
- Qt QML高仿微信
-
Qt以tableWidget/tableView读取xm
l文件,并 - QT状态栏修改
- 使用QT官方库的mqtt客户端
- QT5.12所需ssleay32.dll,libeay32.dll 1.0.2q
-
QT st
yleSheet - 传智播客2016版QT教程
- linux+QT下基于RTP协议的实时视频传输客
- QT 智能家居
- qt写的绘制串口接收到数据的实时曲线
- QT5编译QFtp的具体方法和所用到的资源
- Enigma Virtual Box V7.30官方中文版
- Qt天气助手绘图、获取城市列表
- Qt Designer手册
- qtsnvivo_29157.rar
- 简单的文本编译器
- QT版聊天软件
- 智能家居界面
- Qt编写的Plotter绘制曲线源代码
- Qt项目源码173890
- 传~黑马QT内部讲义
- QT OPENCV车牌识别 识别结果输出到Tex
- 使用Qt实现QQ聊天功能包含实现步骤,
- HLW8032 QT 串口接收
- VS下QT实现仿真小飞机
- Qt 自定义标题栏
- VS2010配置QT和SNMP++
- Qt+Creator快速入门part2
评论
共有 条评论