mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
* [Refactor] Move AbstractGraphicsItem and GraphicsItemType to game_graphics/board folder. Took 3 minutes * Update CMakeLists.txt Took 12 minutes * Update CMakeLists.txt Took 12 minutes Took 2 minutes Took 16 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
70 lines
1.4 KiB
C++
70 lines
1.4 KiB
C++
/**
|
|
* @file arrow_target.h
|
|
* @ingroup GameGraphics
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef ARROWTARGET_H
|
|
#define ARROWTARGET_H
|
|
|
|
#include "../../game_graphics/board/abstract_graphics_item.h"
|
|
|
|
#include <QList>
|
|
|
|
class Player;
|
|
class ArrowItem;
|
|
|
|
class ArrowTarget : public AbstractGraphicsItem
|
|
{
|
|
Q_OBJECT
|
|
protected:
|
|
Player *owner;
|
|
|
|
private:
|
|
bool beingPointedAt;
|
|
QList<ArrowItem *> arrowsFrom, arrowsTo;
|
|
|
|
public:
|
|
explicit ArrowTarget(Player *_owner, QGraphicsItem *parent = nullptr);
|
|
~ArrowTarget() override;
|
|
|
|
[[nodiscard]] Player *getOwner() const
|
|
{
|
|
return owner;
|
|
}
|
|
|
|
void setBeingPointedAt(bool _beingPointedAt);
|
|
[[nodiscard]] bool getBeingPointedAt() const
|
|
{
|
|
return beingPointedAt;
|
|
}
|
|
|
|
[[nodiscard]] const QList<ArrowItem *> &getArrowsFrom() const
|
|
{
|
|
return arrowsFrom;
|
|
}
|
|
void addArrowFrom(ArrowItem *arrow)
|
|
{
|
|
arrowsFrom.append(arrow);
|
|
}
|
|
void removeArrowFrom(ArrowItem *arrow)
|
|
{
|
|
arrowsFrom.removeOne(arrow);
|
|
}
|
|
[[nodiscard]] const QList<ArrowItem *> &getArrowsTo() const
|
|
{
|
|
return arrowsTo;
|
|
}
|
|
void addArrowTo(ArrowItem *arrow)
|
|
{
|
|
arrowsTo.append(arrow);
|
|
}
|
|
void removeArrowTo(ArrowItem *arrow)
|
|
{
|
|
arrowsTo.removeOne(arrow);
|
|
}
|
|
|
|
protected:
|
|
QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override;
|
|
};
|
|
#endif
|