Display message when hovering on border metatiles
This commit is contained in:
parent
3a4ce68232
commit
8594c2ce36
4 changed files with 34 additions and 0 deletions
|
@ -10,6 +10,9 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
### Added
|
### Added
|
||||||
- Add `setScale` to the scripting API.
|
- Add `setScale` to the scripting API.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Hovering on border metatiles with the mouse will now display their information in the bottom bar.
|
||||||
|
|
||||||
## [5.0.0] - 2022-10-30
|
## [5.0.0] - 2022-10-30
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
- Proper support for pokefirered's clone objects was added, which requires the changes made in [pokefirered/#484](https://github.com/pret/pokefirered/pull/484).
|
- Proper support for pokefirered's clone objects was added, which requires the changes made in [pokefirered/#484](https://github.com/pret/pokefirered/pull/484).
|
||||||
|
|
|
@ -18,9 +18,18 @@ public:
|
||||||
Map *map;
|
Map *map;
|
||||||
void draw();
|
void draw();
|
||||||
signals:
|
signals:
|
||||||
|
void hoveredBorderMetatileSelectionChanged(uint16_t);
|
||||||
|
void hoveredBorderMetatileSelectionCleared();
|
||||||
void borderMetatilesChanged();
|
void borderMetatilesChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void hoverUpdate(const QPointF &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||||
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||||
|
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||||
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BORDERMETATILESPIXMAPITEM_H
|
#endif // BORDERMETATILESPIXMAPITEM_H
|
||||||
|
|
|
@ -1443,6 +1443,10 @@ void Editor::displayBorderMetatiles() {
|
||||||
selected_border_metatiles_item->draw();
|
selected_border_metatiles_item->draw();
|
||||||
scene_selected_border_metatiles->addItem(selected_border_metatiles_item);
|
scene_selected_border_metatiles->addItem(selected_border_metatiles_item);
|
||||||
|
|
||||||
|
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionChanged,
|
||||||
|
this, &Editor::onHoveredMetatileSelectionChanged);
|
||||||
|
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::hoveredBorderMetatileSelectionCleared,
|
||||||
|
this, &Editor::onHoveredMetatileSelectionCleared);
|
||||||
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::borderMetatilesChanged,
|
connect(selected_border_metatiles_item, &BorderMetatilesPixmapItem::borderMetatilesChanged,
|
||||||
this, &Editor::onBorderMetatilesChanged);
|
this, &Editor::onBorderMetatilesChanged);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,3 +54,21 @@ void BorderMetatilesPixmapItem::draw() {
|
||||||
|
|
||||||
emit borderMetatilesChanged();
|
emit borderMetatilesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BorderMetatilesPixmapItem::hoverUpdate(const QPointF &pixmapPos) {
|
||||||
|
QPoint pos = Metatile::coordFromPixmapCoord(pixmapPos);
|
||||||
|
uint16_t metatileId = this->map->getBorderMetatileId(pos.x(), pos.y());
|
||||||
|
emit this->hoveredBorderMetatileSelectionChanged(metatileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderMetatilesPixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
|
this->hoverUpdate(event->pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderMetatilesPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
|
||||||
|
this->hoverUpdate(event->pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void BorderMetatilesPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) {
|
||||||
|
emit this->hoveredBorderMetatileSelectionCleared();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue