2018-09-29 20:13:07 +01:00
|
|
|
#ifndef TILESETEDITOR_H
|
|
|
|
#define TILESETEDITOR_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include "project.h"
|
2018-09-29 21:24:35 +01:00
|
|
|
#include "tileseteditormetatileselector.h"
|
2018-09-30 18:33:58 +01:00
|
|
|
#include "tileseteditortileselector.h"
|
2018-09-30 22:15:04 +01:00
|
|
|
#include "metatilelayersitem.h"
|
2018-09-29 20:13:07 +01:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class TilesetEditor;
|
|
|
|
}
|
|
|
|
|
|
|
|
class TilesetEditor : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-09-29 21:24:35 +01:00
|
|
|
explicit TilesetEditor(Project*, QString, QString, QWidget *parent = nullptr);
|
2018-09-29 20:13:07 +01:00
|
|
|
~TilesetEditor();
|
2018-10-03 01:01:18 +01:00
|
|
|
void setTilesets(QString, QString);
|
2018-10-03 01:01:31 +01:00
|
|
|
void init(Project*, QString, QString);
|
2018-09-29 20:13:07 +01:00
|
|
|
|
2018-09-29 21:24:35 +01:00
|
|
|
private slots:
|
|
|
|
void onHoveredMetatileChanged(uint16_t);
|
|
|
|
void onHoveredMetatileCleared();
|
|
|
|
void onSelectedMetatileChanged(uint16_t);
|
2018-09-30 18:33:58 +01:00
|
|
|
void onHoveredTileChanged(uint16_t);
|
|
|
|
void onHoveredTileCleared();
|
2018-10-03 01:01:27 +01:00
|
|
|
void onSelectedTilesChanged();
|
|
|
|
void onMetatileLayerTileChanged(int, int);
|
2018-09-29 21:24:35 +01:00
|
|
|
|
2018-09-30 20:54:38 +01:00
|
|
|
void on_spinBox_paletteSelector_valueChanged(int arg1);
|
|
|
|
|
|
|
|
void on_checkBox_xFlip_stateChanged(int arg1);
|
|
|
|
|
|
|
|
void on_checkBox_yFlip_stateChanged(int arg1);
|
|
|
|
|
2018-10-03 01:01:09 +01:00
|
|
|
void on_comboBox_metatileBehaviors_currentIndexChanged(const QString &arg1);
|
|
|
|
|
|
|
|
void on_comboBox_layerType_currentIndexChanged(int index);
|
|
|
|
|
|
|
|
void on_actionSave_Tileset_triggered();
|
|
|
|
|
2018-10-03 01:01:24 +01:00
|
|
|
void on_actionImport_Primary_Tiles_triggered();
|
|
|
|
|
|
|
|
void on_actionImport_Secondary_Tiles_triggered();
|
|
|
|
|
2018-09-29 20:13:07 +01:00
|
|
|
private:
|
2018-10-03 01:01:31 +01:00
|
|
|
void closeEvent(QCloseEvent*);
|
2018-09-30 18:33:58 +01:00
|
|
|
void initMetatileSelector();
|
|
|
|
void initTileSelector();
|
2018-09-30 20:54:38 +01:00
|
|
|
void initSelectedTileItem();
|
2018-09-30 22:15:04 +01:00
|
|
|
void initMetatileLayersItem();
|
2018-10-03 01:01:27 +01:00
|
|
|
void drawSelectedTiles();
|
2018-10-03 01:01:24 +01:00
|
|
|
void importTilesetTiles(Tileset*, bool);
|
|
|
|
void refresh();
|
2018-09-29 20:13:07 +01:00
|
|
|
Ui::TilesetEditor *ui;
|
2018-09-30 22:15:04 +01:00
|
|
|
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
|
|
|
TilesetEditorTileSelector *tileSelector = nullptr;
|
|
|
|
MetatileLayersItem *metatileLayersItem = nullptr;
|
2018-10-03 01:01:09 +01:00
|
|
|
Project *project = nullptr;
|
|
|
|
Metatile *metatile = nullptr;
|
2018-09-30 20:54:38 +01:00
|
|
|
int paletteId;
|
|
|
|
bool tileXFlip;
|
|
|
|
bool tileYFlip;
|
2018-10-03 01:01:31 +01:00
|
|
|
bool hasUnsavedChanges;
|
|
|
|
Tileset *primaryTileset = nullptr;
|
|
|
|
Tileset *secondaryTileset = nullptr;
|
2018-09-30 20:54:38 +01:00
|
|
|
QGraphicsScene *metatilesScene = nullptr;
|
|
|
|
QGraphicsScene *tilesScene = nullptr;
|
|
|
|
QGraphicsScene *selectedTileScene = nullptr;
|
|
|
|
QGraphicsPixmapItem *selectedTilePixmapItem = nullptr;
|
2018-09-30 22:15:04 +01:00
|
|
|
QGraphicsScene *metatileLayersScene = nullptr;
|
2018-10-03 01:01:15 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void tilesetsSaved(QString, QString);
|
2018-10-03 01:01:31 +01:00
|
|
|
void closed();
|
2018-09-29 20:13:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TILESETEDITOR_H
|