根据网上教程实现的QT翻金币游戏,带dataconflip.h,dataconflip.cpp以及项目资源
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3279 2019-11-04 16:48 Conflipchooselevelscene.cpp
文件 442 2019-11-04 08:45 Conflipchooselevelscene.h
文件 654 2019-11-04 16:15 ConflipConflip.pro
文件 23800 2019-11-04 17:06 ConflipConflip.pro.user
文件 18192 2019-11-03 22:08 ConflipConflip.pro.user.3.2-pre1
文件 7532 2019-11-04 10:48 Conflipdataconfig.cpp
文件 316 2019-11-04 10:28 Conflipdataconfig.h
文件 428 2019-11-04 10:55 Conflipmain.cpp
文件 2372 2019-11-04 16:41 Conflipmainscene.cpp
文件 473 2019-11-03 22:24 Conflipmainscene.h
文件 1072 2019-11-03 09:51 Conflipmainscene.ui
文件 2362 2019-11-04 16:00 Conflipmycoin.cpp
文件 739 2019-11-04 15:39 Conflipmycoin.h
文件 3254 2019-11-03 23:18 Conflipmypushbuttion.cpp
文件 732 2019-11-03 23:14 Conflipmypushbuttion.h
文件 7772 2019-11-04 16:35 Conflipplayscene.cpp
文件 588 2019-11-04 15:29 Conflipplayscene.h
文件 19584 2017-05-17 10:34 Conflip
esBackButton.png
文件 19565 2017-05-17 10:47 Conflip
esBackButtonselected.png
文件 20478 2017-06-17 17:26 Conflip
esBackButtonSound.wav
文件 18012 2017-05-17 10:50 Conflip
esBoardNode.png
文件 22640 2017-05-17 11:11 Conflip
esCoin0001.png
文件 21961 2017-06-18 21:39 Conflip
esCoin0002.png
文件 20720 2017-06-18 21:39 Conflip
esCoin0003.png
文件 18540 2017-06-18 21:39 Conflip
esCoin0004.png
文件 18715 2017-06-18 21:39 Conflip
esCoin0005.png
文件 20955 2017-06-18 21:39 Conflip
esCoin0006.png
文件 22276 2017-06-18 21:39 Conflip
esCoin0007.png
文件 22912 2017-05-17 11:30 Conflip
esCoin0008.png
文件 61418 2017-06-17 17:26 Conflip
esConFlipSound.wav
............此处省略15个文件信息
#include “chooselevelscene.h“
#include“mypushbuttion.h“
#include
#include
#include
#include
ChooseLevelScene::ChooseLevelScene(QWidget *parent) :
QMainWindow(parent)
{
//设置固定大小
this->setFixedSize(320588);
//设置标题
this->setWindowtitle(“选择关卡场景“);
//设置标题图片
this->setWindowIcon(QPixmap(“:/res/Coin0001.png“));
//创建菜单栏
QMenuBar *bar=menuBar();
this->setMenuBar(bar);
//创建开始菜单
QMenu *startMenu=bar->addMenu(“开始“);
//创建菜单项
QAction *quitAction=startMenu->addAction(“退出“);
//点击退出按钮
connect(quitAction&QAction::triggered[=](){
this->close();
});
QSound *chooseSound=new QSound(“:/res/TapButtonSound.wav“this);
QSound *backSound=new QSound(“:/res/BackButtonSound.wav“this);
//返回按钮封装
MyPushButtion *backBtn=new MyPushButtion(“:/res/BackButton.png““:/res/BackButtonselected“);
backBtn->setParent(this);
backBtn->move(this->width()-backBtn->width()this->height()-backBtn->height());
connect(backBtn&QPushButton::clicked[=](){
backSound->play();
// qDebug()<<“返回到主场景“;
QTimer::singleShot(500this[=](){
this->hide();
emit this->chooseSceneBack();
});
});
//选择关卡的按钮
for(int i=0;i<20;i++)
{
MyPushButtion *menuBtn=new MyPushButtion(“:/res/LevelIcon.png“);
menuBtn->setParent(this);
menuBtn->move(25+(i%4)*70130+(i/4)*70);
connect(menuBtn&MyPushButtion::clicked[=](){
// QString str=QString(“进入第%1关“).arg(i+1);
// qDebug()<
chooseSound->play();
if(pScene==NULL)//游戏场景最好不要复用,直接移除掉创建的场景
{
this->hide();
pScene=new playScene(i+1);//将选择的关卡好传入给PlayScene
pScene->setGeometry(this->geometry());
pScene->show();
connect(pScene&playScene::backToChoose[=](){
this->setGeometry(pScene->geometry());
pScene->close();
delete pScene;
pScene=NULL;
this->show();
});
}
});
//按钮上显示文字
QLabel *label=new QLabel;
label->setParent(this);
label->setFixedSize(menuBtn->width()menuBtn->height());
label->setText(QString::number(i+1));
label->move(25+(i%4)*70130+(i/4)*70);
label->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
//设置鼠标的穿透
label->setAttribute(Qt::WA_TransparentForMouseEvents);
}
}
void ChooseLevelScene::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
QPixmap pix;
pix.load(“:/res/OtherSceneBg.png“);
painter.drawPixmap(00this->width()this->height()pix);
//加标题
pix.load(“:/res/title.png“);
painter.drawPixmap(this->width()*0.5-pix.width()*0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3279 2019-11-04 16:48 Conflipchooselevelscene.cpp
文件 442 2019-11-04 08:45 Conflipchooselevelscene.h
文件 654 2019-11-04 16:15 ConflipConflip.pro
文件 23800 2019-11-04 17:06 ConflipConflip.pro.user
文件 18192 2019-11-03 22:08 ConflipConflip.pro.user.3.2-pre1
文件 7532 2019-11-04 10:48 Conflipdataconfig.cpp
文件 316 2019-11-04 10:28 Conflipdataconfig.h
文件 428 2019-11-04 10:55 Conflipmain.cpp
文件 2372 2019-11-04 16:41 Conflipmainscene.cpp
文件 473 2019-11-03 22:24 Conflipmainscene.h
文件 1072 2019-11-03 09:51 Conflipmainscene.ui
文件 2362 2019-11-04 16:00 Conflipmycoin.cpp
文件 739 2019-11-04 15:39 Conflipmycoin.h
文件 3254 2019-11-03 23:18 Conflipmypushbuttion.cpp
文件 732 2019-11-03 23:14 Conflipmypushbuttion.h
文件 7772 2019-11-04 16:35 Conflipplayscene.cpp
文件 588 2019-11-04 15:29 Conflipplayscene.h
文件 19584 2017-05-17 10:34 Conflip
esBackButton.png
文件 19565 2017-05-17 10:47 Conflip
esBackButton
文件 20478 2017-06-17 17:26 Conflip
esBackButtonSound.wav
文件 18012 2017-05-17 10:50 Conflip
esBoardNode.png
文件 22640 2017-05-17 11:11 Conflip
esCoin0001.png
文件 21961 2017-06-18 21:39 Conflip
esCoin0002.png
文件 20720 2017-06-18 21:39 Conflip
esCoin0003.png
文件 18540 2017-06-18 21:39 Conflip
esCoin0004.png
文件 18715 2017-06-18 21:39 Conflip
esCoin0005.png
文件 20955 2017-06-18 21:39 Conflip
esCoin0006.png
文件 22276 2017-06-18 21:39 Conflip
esCoin0007.png
文件 22912 2017-05-17 11:30 Conflip
esCoin0008.png
文件 61418 2017-06-17 17:26 Conflip
esConFlipSound.wav
............此处省略15个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)