2018-09-27 00:30:05 +01:00
|
|
|
#ifndef COLLISIONPIXMAPITEM_H
|
|
|
|
#define COLLISIONPIXMAPITEM_H
|
|
|
|
|
2023-12-07 18:45:08 +00:00
|
|
|
#include <QSpinBox>
|
|
|
|
|
2018-09-27 00:30:05 +01:00
|
|
|
#include "metatileselector.h"
|
|
|
|
#include "movementpermissionsselector.h"
|
2023-02-01 15:09:50 +00:00
|
|
|
#include "layoutpixmapitem.h"
|
2018-09-27 00:30:05 +01:00
|
|
|
#include "map.h"
|
|
|
|
#include "settings.h"
|
|
|
|
|
2023-02-01 15:09:50 +00:00
|
|
|
class CollisionPixmapItem : public LayoutPixmapItem {
|
2018-09-27 00:30:05 +01:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2024-01-09 19:52:00 +00:00
|
|
|
CollisionPixmapItem(Layout *layout, QSpinBox * selectedCollision, QSpinBox * selectedElevation, MetatileSelector *metatileSelector, Settings *settings, qreal *opacity)
|
2023-02-01 15:09:50 +00:00
|
|
|
: LayoutPixmapItem(layout, metatileSelector, settings){
|
2023-12-07 18:45:08 +00:00
|
|
|
this->selectedCollision = selectedCollision;
|
|
|
|
this->selectedElevation = selectedElevation;
|
2019-01-06 18:53:31 +00:00
|
|
|
this->opacity = opacity;
|
2023-02-01 15:09:50 +00:00
|
|
|
layout->setCollisionItem(this);
|
2018-09-27 00:30:05 +01:00
|
|
|
}
|
2023-12-07 18:45:08 +00:00
|
|
|
QSpinBox * selectedCollision;
|
|
|
|
QSpinBox * selectedElevation;
|
2019-01-06 18:53:31 +00:00
|
|
|
qreal *opacity;
|
2018-09-27 00:30:05 +01:00
|
|
|
void updateMovementPermissionSelection(QGraphicsSceneMouseEvent *event);
|
|
|
|
virtual void paint(QGraphicsSceneMouseEvent*);
|
|
|
|
virtual void floodFill(QGraphicsSceneMouseEvent*);
|
2019-01-05 02:49:21 +00:00
|
|
|
virtual void magicFill(QGraphicsSceneMouseEvent*);
|
2018-09-27 00:30:05 +01:00
|
|
|
virtual void pick(QGraphicsSceneMouseEvent*);
|
2019-01-06 18:53:31 +00:00
|
|
|
void draw(bool ignoreCache = false);
|
2018-09-27 00:30:05 +01:00
|
|
|
|
2020-08-01 01:30:35 +01:00
|
|
|
private:
|
|
|
|
unsigned actionId_ = 0;
|
2022-01-11 14:25:05 +00:00
|
|
|
QPoint previousPos;
|
2023-12-07 18:45:08 +00:00
|
|
|
void updateSelection(QPoint pos);
|
2020-08-01 01:30:35 +01:00
|
|
|
|
2018-09-27 00:30:05 +01:00
|
|
|
signals:
|
|
|
|
void mouseEvent(QGraphicsSceneMouseEvent *, CollisionPixmapItem *);
|
|
|
|
void hoveredMapMovementPermissionChanged(int, int);
|
|
|
|
void hoveredMapMovementPermissionCleared();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
2022-01-11 14:25:05 +00:00
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent*);
|
2018-09-27 00:30:05 +01:00
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // COLLISIONPIXMAPITEM_H
|