1 Star 0 Fork 0

Mrack/ MyShapez

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
RoundScene.cpp 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
Mrack 提交于 2024-06-24 23:59 . 888
#include "RoundScene.h"
#include "config.h"
RoundScene::RoundScene()
{
confirm = new QPushButton(this);
// 初始化确认按钮
confirm->setFixedSize(200, 100);
confirm->setStyleSheet("QPushButton{image: url(:/res/confirm.png)}");
// 像素画下载
QString path[] = {CYCLE_PATH, RECT_PATH, LEFT_CYCLE_PATH, RIGHT_CYCLE_PATH};
for (int i = 0; i < 4; ++i)
{
img[i].load(path[i]);
}
// 初始化关卡
level = 1;
}
void RoundScene::paintEvent(QPaintEvent *e)
{
QString levelName[] = {"第一关", "第二关", "第三关", "第四关"};
QString levelValue[] = {"*20", "*30", "*40", "*50"};
QPainter painter(this);
if (level > 0 && level <= 4)
{
painter.setFont(QFont("楷体", 55, QFont::Bold));
painter.drawText(WidgetInfo::WIDGET_WIDTH / 2 - 110, WidgetInfo::WIDGET_HEIGHT / 2 - 150, QString(levelName[level - 1]));
painter.drawPixmap(WidgetInfo::WIDGET_WIDTH / 2 - 50, WidgetInfo::WIDGET_HEIGHT / 2 - 100, 100, 100, img[level - 1]);
painter.setFont(QFont("楷体", 45, QFont::Bold));
painter.drawText(WidgetInfo::WIDGET_WIDTH / 2 - 50, WidgetInfo::WIDGET_HEIGHT / 2 + 100, QString(levelValue[level - 1]));
}
confirm->move(WidgetInfo::WIDGET_WIDTH / 2 - 100, WidgetInfo::WIDGET_HEIGHT / 2 + 150);
confirm->show();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/stucky/MyShapez-new.git
[email protected]:stucky/MyShapez-new.git
stucky
MyShapez-new
MyShapez
master

搜索帮助