mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
correct mirroring of players when spectating
This commit is contained in:
parent
e1a728328e
commit
f2092b89e9
18 changed files with 690 additions and 179 deletions
38
cockatrice/src/handcounter.cpp
Normal file
38
cockatrice/src/handcounter.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <QPainter>
|
||||
#include <QSvgRenderer>
|
||||
#include "handcounter.h"
|
||||
#include "cardzone.h"
|
||||
|
||||
HandCounter::HandCounter(QGraphicsItem *parent)
|
||||
: AbstractGraphicsItem(parent), number(0)
|
||||
{
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
|
||||
QSvgRenderer svg(QString(":/resources/hand.svg"));
|
||||
handImage = new QPixmap(72, 72);
|
||||
handImage->fill(Qt::transparent);
|
||||
QPainter painter(handImage);
|
||||
svg.render(&painter, QRectF(0, 0, 72, 72));
|
||||
}
|
||||
|
||||
HandCounter::~HandCounter()
|
||||
{
|
||||
delete handImage;
|
||||
}
|
||||
|
||||
void HandCounter::updateNumber()
|
||||
{
|
||||
number = static_cast<CardZone *>(sender())->getCards().size();
|
||||
update();
|
||||
}
|
||||
|
||||
QRectF HandCounter::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, 72, 72);
|
||||
}
|
||||
|
||||
void HandCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
{
|
||||
painter->drawPixmap(handImage->rect(), *handImage, handImage->rect());
|
||||
paintNumberEllipse(number, painter);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue