1 Star 0 Fork 82

13506519592 / 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);
}
1
https://gitee.com/one-hundred12-and-thirty-five/landlords.git
git@gitee.com:one-hundred12-and-thirty-five/landlords.git
one-hundred12-and-thirty-five
landlords
Landlords
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891