Add grids to tileset editor

This commit is contained in:
GriffinR
2023-12-19 21:21:16 -05:00
parent 93fb8cf471
commit a2d230666b
10 changed files with 196 additions and 68 deletions

View File

@@ -62,6 +62,8 @@ public:
this->showCursorTile = true;
this->showBorder = true;
this->showGrid = false;
this->showTilesetEditorMetatileGrid = false;
this->showTilesetEditorLayerGrid = true;
this->monitorFiles = true;
this->tilesetCheckerboardFill = true;
this->theme = "default";
@@ -88,6 +90,8 @@ public:
void setShowCursorTile(bool enabled);
void setShowBorder(bool enabled);
void setShowGrid(bool enabled);
void setShowTilesetEditorMetatileGrid(bool enabled);
void setShowTilesetEditorLayerGrid(bool enabled);
void setMonitorFiles(bool monitor);
void setTilesetCheckerboardFill(bool checkerboard);
void setTheme(QString theme);
@@ -113,6 +117,8 @@ public:
bool getShowCursorTile();
bool getShowBorder();
bool getShowGrid();
bool getShowTilesetEditorMetatileGrid();
bool getShowTilesetEditorLayerGrid();
bool getMonitorFiles();
bool getTilesetCheckerboardFill();
QString getTheme();
@@ -156,6 +162,8 @@ private:
bool showCursorTile;
bool showBorder;
bool showGrid;
bool showTilesetEditorMetatileGrid;
bool showTilesetEditorLayerGrid;
bool monitorFiles;
bool tilesetCheckerboardFill;
QString theme;

View File

@@ -19,6 +19,7 @@ public:
void setTilesets(Tileset*, Tileset*);
void setMetatile(Metatile*);
void clearLastModifiedCoords();
bool showGrid;
private:
Metatile* metatile;
Tileset *primaryTileset;

View File

@@ -84,6 +84,8 @@ private slots:
void on_actionShow_Unused_toggled(bool checked);
void on_actionShow_Counts_toggled(bool checked);
void on_actionShow_UnusedTiles_toggled(bool checked);
void on_actionMetatile_Grid_triggered(bool checked);
void on_actionLayer_Grid_triggered(bool checked);
void on_actionUndo_triggered();

View File

@@ -22,6 +22,7 @@ public:
QVector<uint16_t> usedMetatiles;
bool selectorShowUnused = false;
bool selectorShowCounts = false;
bool showGrid;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent*);
@@ -35,10 +36,12 @@ private:
Tileset *secondaryTileset = nullptr;
uint16_t selectedMetatile;
int numMetatilesWide;
int numMetatilesHigh;
uint16_t getMetatileId(int x, int y);
QPoint getMetatileIdCoords(uint16_t);
bool shouldAcceptEvent(QGraphicsSceneMouseEvent*);
int numRows(int numMetatiles);
int numRows();
void drawFilters();
void drawUnused();
void drawCounts();