mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
arrows can target players now
This commit is contained in:
parent
cbf201ed9b
commit
61b82bd6f9
25 changed files with 802 additions and 489 deletions
23
cockatrice/src/playertarget.cpp
Normal file
23
cockatrice/src/playertarget.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "playertarget.h"
|
||||
#include <QPainter>
|
||||
|
||||
PlayerTarget::PlayerTarget(const QString &_name, int _maxWidth, QGraphicsItem *parent)
|
||||
: ArrowTarget(parent), name(_name), maxWidth(_maxWidth)
|
||||
{
|
||||
font = QFont("Times");
|
||||
font.setStyleHint(QFont::Serif);
|
||||
font.setPixelSize(20);
|
||||
}
|
||||
|
||||
QRectF PlayerTarget::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, maxWidth, 30);
|
||||
}
|
||||
|
||||
void PlayerTarget::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
{
|
||||
painter->fillRect(boundingRect(), QColor(255, 255, 255, 100));
|
||||
painter->setFont(font);
|
||||
painter->setPen(Qt::black);
|
||||
painter->drawText(boundingRect(), Qt::AlignCenter, name);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue