2018-09-30 22:15:04 +01:00
|
|
|
#ifndef METATILELAYERSITEM_H
|
|
|
|
#define METATILELAYERSITEM_H
|
|
|
|
|
|
|
|
#include "tileset.h"
|
2018-10-06 21:49:26 +01:00
|
|
|
#include "selectablepixmapitem.h"
|
2018-09-30 22:15:04 +01:00
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
|
2018-10-06 21:49:26 +01:00
|
|
|
class MetatileLayersItem: public SelectablePixmapItem {
|
2018-09-30 22:15:04 +01:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-07-14 23:54:56 +01:00
|
|
|
MetatileLayersItem(Metatile *metatile, Tileset *primaryTileset, Tileset *secondaryTileset): SelectablePixmapItem(16, 16, 6, 2) {
|
2018-09-30 22:15:04 +01:00
|
|
|
this->metatile = metatile;
|
|
|
|
this->primaryTileset = primaryTileset;
|
|
|
|
this->secondaryTileset = secondaryTileset;
|
2018-10-06 23:07:36 +01:00
|
|
|
this->clearLastModifiedCoords();
|
2018-09-30 22:15:04 +01:00
|
|
|
}
|
|
|
|
void draw();
|
|
|
|
void setTilesets(Tileset*, Tileset*);
|
|
|
|
void setMetatile(Metatile*);
|
2018-10-06 23:07:36 +01:00
|
|
|
void clearLastModifiedCoords();
|
2018-09-30 22:15:04 +01:00
|
|
|
private:
|
|
|
|
Metatile* metatile;
|
|
|
|
Tileset *primaryTileset;
|
|
|
|
Tileset *secondaryTileset;
|
2018-10-06 23:07:36 +01:00
|
|
|
QPoint prevChangedTile;
|
|
|
|
void getBoundedCoords(QPointF, int*, int*);
|
2018-09-30 22:15:04 +01:00
|
|
|
signals:
|
2018-10-03 01:01:27 +01:00
|
|
|
void tileChanged(int, int);
|
2018-10-06 21:49:26 +01:00
|
|
|
void selectedTilesChanged(QPoint, int, int);
|
2018-09-30 22:15:04 +01:00
|
|
|
protected:
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
2018-10-06 21:49:26 +01:00
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
2018-09-30 22:15:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // METATILELAYERSITEM_H
|