1 Star 0 Fork 87

xiaok/Landlords

forked from ibc-dabing/Landlords 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
endingpanel.cpp 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
kevin 提交于 2021-12-07 23:24 . add file
#include "endingpanel.h"
#include <QPainter>
EndingPanel::EndingPanel(bool isLord, bool isWin, QWidget *parent) : QWidget(parent)
{
m_bk.load(":/images/gameover.png");
setFixedSize(m_bk.size());
m_title = new QLabel(this);
if(isLord && isWin)
{
m_title->setPixmap(QPixmap(":/images/lord_win.png"));
}
else if(isLord && !isWin)
{
m_title->setPixmap(QPixmap(":/images/lord_fail.png"));
}
else if(!isLord && isWin)
{
m_title->setPixmap(QPixmap(":/images/farmer_win.png"));
}
else if(!isLord && !isWin)
{
m_title->setPixmap(QPixmap(":/images/farmer_fail.png"));
}
m_title->move(125, 125);
m_score = new ScorePanel(this);
m_score->move(75, 230);
m_score->setFixedSize(260, 160);
m_score->setMyFontColor(ScorePanel::Red);
m_score->setMyFontSize(18);
m_continue = new QPushButton(this);
m_continue->move(84, 429);
QString style = R"(
QPushButton{border-image: url(:/images/button_normal.png)}
QPushButton:hover{border-image: url(:/images/button_hover.png)}
QPushButton:pressed{border-image: url(:/images/button_pressed.png)}
)";
m_continue->setStyleSheet(style);
m_continue->setFixedSize(231, 48);
connect(m_continue, &QPushButton::clicked, this, &EndingPanel::continueGame);
}
void EndingPanel::setPlayerScore(int left, int right, int me)
{
m_score->setScores(left, right, me);
}
void EndingPanel::paintEvent(QPaintEvent *ev)
{
Q_UNUSED(ev)
QPainter p(this);
p.drawPixmap(rect(), m_bk);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiaok1/landlords.git
git@gitee.com:xiaok1/landlords.git
xiaok1
landlords
Landlords
master

搜索帮助