mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 17:05:43 -05:00
add layout view to region map editor
This commit is contained in:
42
include/ui/regionmaplayoutpixmapitem.h
Normal file
42
include/ui/regionmaplayoutpixmapitem.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef REGIONMAPLAYOUTPIXMAPITEM_H
|
||||
#define REGIONMAPLAYOUTPIXMAPITEM_H
|
||||
|
||||
#include "tilemaptileselector.h"
|
||||
//#include "regionmappixmapitem.h"
|
||||
#include "regionmapeditor.h"
|
||||
|
||||
class RegionMapLayoutPixmapItem : public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RegionMapLayoutPixmapItem(RegionMap *rmap, TilemapTileSelector *ts) : SelectablePixmapItem(8, 8, 1, 1) {
|
||||
//
|
||||
this->region_map = rmap;
|
||||
this->tile_selector = ts;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
RegionMap *region_map;// inherited from RegionMapPixmapItem?
|
||||
TilemapTileSelector *tile_selector;
|
||||
int selectedTile;// index in map_squares
|
||||
void draw();
|
||||
void select(int, int);
|
||||
void setDefaultSelection();
|
||||
|
||||
private:
|
||||
void updateSelectedTile();
|
||||
|
||||
// can I implement these if they are virtual?
|
||||
signals:
|
||||
void mouseEvent(QGraphicsSceneMouseEvent *, RegionMapLayoutPixmapItem *);
|
||||
void hoveredTileChanged(int);
|
||||
void hoveredTileCleared();
|
||||
void selectedTileChanged(int);
|
||||
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // REGIONMAPLAYOUTPIXMAPITEM_H
|
||||
@@ -8,7 +8,7 @@ class TilemapTileSelector: public SelectablePixmapItem {
|
||||
public:
|
||||
TilemapTileSelector(QPixmap pixmap): SelectablePixmapItem(8, 8, 1, 1) {
|
||||
this->pixmap = pixmap;
|
||||
this->numTilesWide = 16;
|
||||
this->numTilesWide = pixmap.width() / 8;
|
||||
this->selectedTile = 0x00;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user