mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-10 09:55:41 -05:00
Properly paint prefabs and create them from dialog box
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
28
include/ui/prefabcreationdialog.h
Normal file
28
include/ui/prefabcreationdialog.h
Normal 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
|
||||
Reference in New Issue
Block a user