mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 17:32:17 -07:00
[Game/Zones] Simple move refactor to differentiate between logic and graphics for zones (#6903)
* [Game/Zones] Simple move refactor to differentiate between logic and graphics for zones Took 21 minutes * Clean up game/zones/logic folder. Took 6 minutes * Adjust tests. Took 3 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
bb1a5b33a1
commit
cba9ce2b2b
47 changed files with 107 additions and 107 deletions
42
cockatrice/src/game_graphics/zones/pile_zone.h
Normal file
42
cockatrice/src/game_graphics/zones/pile_zone.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* @file pile_zone.h
|
||||
* @ingroup GameGraphicsZones
|
||||
* @brief TODO: Document this.
|
||||
*/
|
||||
|
||||
#ifndef PILEZONE_H
|
||||
#define PILEZONE_H
|
||||
|
||||
#include "../../game/zones/pile_zone_logic.h"
|
||||
#include "card_zone.h"
|
||||
|
||||
/**
|
||||
* A CardZone where the cards are in a single pile instead of being laid out.
|
||||
* Usually only top card is accessible by clicking.
|
||||
*/
|
||||
class PileZone : public CardZone
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void callUpdate()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
public:
|
||||
PileZone(PileZoneLogic *_logic, QGraphicsItem *parent);
|
||||
[[nodiscard]] QRectF boundingRect() const override;
|
||||
[[nodiscard]] QPainterPath shape() const override;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
void reorganizeCards() override;
|
||||
void
|
||||
handleDropEvent(const QList<CardDragItem *> &dragItems, CardZoneLogic *startZone, const QPoint &dropPoint) override;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue