Properly paint prefabs and create them from dialog box

This commit is contained in:
Marcus Huderle
2022-09-07 20:38:30 -05:00
parent bc4cbbabfa
commit 96ad32c6db
11 changed files with 358 additions and 21 deletions

View File

@@ -14,11 +14,15 @@ public:
public:
void mousePressEvent(QMouseEvent *event) {
QGraphicsView::mousePressEvent(event);
emit this->clicked();
emit this->clicked(event);
}
void mouseDoubleClickEvent(QMouseEvent *event) {
QGraphicsView::mouseDoubleClickEvent(event);
emit this->clicked(event);
}
signals:
void clicked();
void clicked(QMouseEvent *event);
};
class Editor;

View File

@@ -18,11 +18,16 @@ struct PrefabItem
class Prefab
{
public:
void initPrefabUI(MetatileSelector *selector, QWidget *prefabWidget, QLabel *emptyPrefabLabel, QString primaryTileset, QString secondaryTileset, Map *map);
void initPrefabUI(MetatileSelector *selector, QWidget *prefabWidget, QLabel *emptyPrefabLabel, Map *map);
void addPrefab(MetatileSelection selection, Map *map, QString name);
private:
MetatileSelector *selector;
QWidget *prefabWidget;
QLabel *emptyPrefabLabel;
QList<PrefabItem> items;
void loadPrefabs();
void updatePrefabUi(Map *map);
QList<PrefabItem> getPrefabsForTilesets(QString primaryTileset, QString secondaryTileset);
};

View File

@@ -0,0 +1,28 @@
#ifndef PREFABCREATIONDIALOG_H
#define PREFABCREATIONDIALOG_H
#include "metatileselector.h"
#include "map.h"
#include <QDialog>
namespace Ui {
class PrefabCreationDialog;
}
class PrefabCreationDialog : public QDialog
{
Q_OBJECT
public:
explicit PrefabCreationDialog(QWidget *parent, MetatileSelector *metatileSelector, Map *map);
~PrefabCreationDialog();
void savePrefab();
private:
Map *map;
Ui::PrefabCreationDialog *ui;
MetatileSelection selection;
};
#endif // PREFABCREATIONDIALOG_H