mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-12 19:05:37 -05:00
fix edit commands and ui things to use layout instead of map
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
#ifndef CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
#define CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
|
||||
#include "map.h"
|
||||
#include "metatileselector.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
class Layout;
|
||||
|
||||
class CurrentSelectedMetatilesPixmapItem : public QGraphicsPixmapItem {
|
||||
public:
|
||||
CurrentSelectedMetatilesPixmapItem(Map *map, MetatileSelector *metatileSelector) {
|
||||
this->map = map;
|
||||
CurrentSelectedMetatilesPixmapItem(Layout *layout, MetatileSelector *metatileSelector) {
|
||||
this->layout = layout;
|
||||
this->metatileSelector = metatileSelector;
|
||||
}
|
||||
Map* map = nullptr;
|
||||
Layout *layout = nullptr;
|
||||
MetatileSelector *metatileSelector;
|
||||
void draw();
|
||||
|
||||
void setMap(Map *map) { this->map = map; }
|
||||
void setLayout(Layout *layout) { this->layout = layout; }
|
||||
};
|
||||
|
||||
QPixmap drawMetatileSelection(MetatileSelection selection, Map *map);
|
||||
QPixmap drawMetatileSelection(MetatileSelection selection, Layout *layout);
|
||||
|
||||
#endif // CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
|
||||
@@ -31,13 +31,13 @@ struct MetatileSelection
|
||||
class MetatileSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MetatileSelector(int numMetatilesWide, Map *map): SelectablePixmapItem(16, 16) {
|
||||
MetatileSelector(int numMetatilesWide, Layout *layout): SelectablePixmapItem(16, 16) {
|
||||
this->externalSelection = false;
|
||||
this->prefabSelection = false;
|
||||
this->numMetatilesWide = numMetatilesWide;
|
||||
this->map = map;
|
||||
this->primaryTileset = map->layout->tileset_primary;
|
||||
this->secondaryTileset = map->layout->tileset_secondary;
|
||||
this->layout = layout;
|
||||
this->primaryTileset = layout->tileset_primary;
|
||||
this->secondaryTileset = layout->tileset_secondary;
|
||||
this->selection = MetatileSelection{};
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
void setPrefabSelection(MetatileSelection selection);
|
||||
void setExternalSelection(int, int, QList<uint16_t>, QList<QPair<uint16_t, uint16_t>>);
|
||||
QPoint getMetatileIdCoordsOnWidget(uint16_t);
|
||||
void setMap(Map*);
|
||||
void setLayout(Layout *layout);
|
||||
Tileset *primaryTileset;
|
||||
Tileset *secondaryTileset;
|
||||
protected:
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
bool externalSelection;
|
||||
bool prefabSelection;
|
||||
int numMetatilesWide;
|
||||
Map *map;
|
||||
Layout *layout;
|
||||
int externalSelectionWidth;
|
||||
int externalSelectionHeight;
|
||||
QList<uint16_t> externalSelectedMetatiles;
|
||||
|
||||
@@ -20,9 +20,9 @@ struct PrefabItem
|
||||
class Prefab
|
||||
{
|
||||
public:
|
||||
void initPrefabUI(MetatileSelector *selector, QWidget *prefabWidget, QLabel *emptyPrefabLabel, Map *map);
|
||||
void addPrefab(MetatileSelection selection, Map *map, QString name);
|
||||
void updatePrefabUi(Map *map);
|
||||
void initPrefabUI(MetatileSelector *selector, QWidget *prefabWidget, QLabel *emptyPrefabLabel, Layout *layout);
|
||||
void addPrefab(MetatileSelection selection, Layout *layout, QString name);
|
||||
void updatePrefabUi(Layout *layout);
|
||||
bool tryImportDefaultPrefabs(QWidget * parent, BaseGameVersion version, QString filepath = "");
|
||||
|
||||
private:
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
#define PREFABCREATIONDIALOG_H
|
||||
|
||||
#include "metatileselector.h"
|
||||
#include "map.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class Layout;
|
||||
|
||||
namespace Ui {
|
||||
class PrefabCreationDialog;
|
||||
}
|
||||
@@ -15,12 +16,12 @@ class PrefabCreationDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrefabCreationDialog(QWidget *parent, MetatileSelector *metatileSelector, Map *map);
|
||||
explicit PrefabCreationDialog(QWidget *parent, MetatileSelector *metatileSelector, Layout *layout);
|
||||
~PrefabCreationDialog();
|
||||
void savePrefab();
|
||||
|
||||
private:
|
||||
Map *map;
|
||||
Layout *layout = nullptr;
|
||||
Ui::PrefabCreationDialog *ui;
|
||||
MetatileSelection selection;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include "tileseteditormetatileselector.h"
|
||||
#include "tileseteditortileselector.h"
|
||||
#include "metatilelayersitem.h"
|
||||
#include "map.h"
|
||||
|
||||
class Layout;
|
||||
|
||||
namespace Ui {
|
||||
class TilesetEditor;
|
||||
@@ -39,10 +40,10 @@ class TilesetEditor : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TilesetEditor(Project*, Map*, QWidget *parent = nullptr);
|
||||
explicit TilesetEditor(Project *project, Layout *layout, QWidget *parent = nullptr);
|
||||
~TilesetEditor();
|
||||
void update(Map *map, QString primaryTilsetLabel, QString secondaryTilesetLabel);
|
||||
void updateMap(Map *map);
|
||||
void update(Layout *layout, QString primaryTilsetLabel, QString secondaryTilesetLabel);
|
||||
void updateLayout(Layout *layout);
|
||||
void updateTilesets(QString primaryTilsetLabel, QString secondaryTilesetLabel);
|
||||
bool selectMetatile(uint16_t metatileId);
|
||||
uint16_t getSelectedMetatileId();
|
||||
@@ -148,7 +149,7 @@ private:
|
||||
MetatileLayersItem *metatileLayersItem = nullptr;
|
||||
PaletteEditor *paletteEditor = nullptr;
|
||||
Project *project = nullptr;
|
||||
Map *map = nullptr;
|
||||
Layout *layout = nullptr;
|
||||
Metatile *metatile = nullptr;
|
||||
Metatile *copiedMetatile = nullptr;
|
||||
QString copiedMetatileLabel;
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
|
||||
#include "selectablepixmapitem.h"
|
||||
#include "tileset.h"
|
||||
#include "map.h"
|
||||
|
||||
class Layout;
|
||||
|
||||
class TilesetEditorMetatileSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TilesetEditorMetatileSelector(Tileset *primaryTileset, Tileset *secondaryTileset, Map *map);
|
||||
Map *map = nullptr;
|
||||
TilesetEditorMetatileSelector(Tileset *primaryTileset, Tileset *secondaryTileset, Layout *layout);
|
||||
Layout *layout = nullptr;
|
||||
void draw();
|
||||
bool select(uint16_t metatileId);
|
||||
void setTilesets(Tileset*, Tileset*, bool draw = true);
|
||||
|
||||
Reference in New Issue
Block a user