Add layering to scripting overlay

This commit is contained in:
GriffinR
2021-11-30 12:58:39 -05:00
committed by huderlem
parent 630febff54
commit af4c99537f
7 changed files with 49 additions and 23 deletions

View File

@@ -67,11 +67,11 @@ public:
Q_INVOKABLE void setDimensions(int width, int height);
Q_INVOKABLE void setWidth(int width);
Q_INVOKABLE void setHeight(int height);
Q_INVOKABLE void clearOverlay();
Q_INVOKABLE void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12);
Q_INVOKABLE void addRect(int x, int y, int width, int height, QString color = "#000000");
Q_INVOKABLE void addFilledRect(int x, int y, int width, int height, QString color = "#000000");
Q_INVOKABLE void addImage(int x, int y, QString filepath, int width = -1, int height = -1, unsigned offset = 0, bool hflip = false, bool vflip = false, bool setTransparency = false);
Q_INVOKABLE void clearOverlay(int layer = INT_MAX);
Q_INVOKABLE void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12, int layer = 0);
Q_INVOKABLE void addRect(int x, int y, int width, int height, QString color = "#000000", int layer = 0);
Q_INVOKABLE void addFilledRect(int x, int y, int width, int height, QString color = "#000000", int layer = 0);
Q_INVOKABLE void addImage(int x, int y, QString filepath, int width = -1, int height = -1, unsigned offset = 0, bool hflip = false, bool vflip = false, bool setTransparency = false, int layer = 0);
void refreshAfterPaletteChange(Tileset *tileset);
void setTilesetPalette(Tileset *tileset, int paletteIndex, QList<QList<int>> colors);
Q_INVOKABLE void setPrimaryTilesetPalette(int paletteIndex, QList<QList<int>> colors);

View File

@@ -12,11 +12,13 @@ class GraphicsView : public QGraphicsView
public:
GraphicsView() : QGraphicsView() {}
GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
Overlay * getOverlay(int layer);
void clearOverlays();
public:
// GraphicsView_Object object;
Editor *editor;
Overlay overlay;
QMap<int, Overlay*> overlayMap;
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);

View File

@@ -75,6 +75,7 @@ public:
~Overlay() {
this->clearItems();
}
void renderItems(QPainter *painter);
QList<OverlayItem*> getItems();
void clearItems();
void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12);