porymap/include/ui/metatilelayersitem.h

38 lines
1.1 KiB
C
Raw Normal View History

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