From 8f90ca64b49d4b748e90fb932ec9d751e27a5aac Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 28 Aug 2022 21:45:52 -0400 Subject: [PATCH] Add basic border functions to API --- include/mainwindow.h | 8 ++++++ src/mainwindow_scriptapi.cpp | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/include/mainwindow.h b/include/mainwindow.h index 1174060b..d64e0d65 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -50,6 +50,8 @@ public: Q_INVOKABLE void setBlocksFromSelection(int x, int y, bool forceRedraw = true, bool commitChanges = true); Q_INVOKABLE int getMetatileId(int x, int y); Q_INVOKABLE void setMetatileId(int x, int y, int metatileId, bool forceRedraw = true, bool commitChanges = true); + Q_INVOKABLE int getBorderMetatileId(int x, int y); + Q_INVOKABLE void setBorderMetatileId(int x, int y, int metatileId, bool forceRedraw = true, bool commitChanges = true); Q_INVOKABLE int getCollision(int x, int y); Q_INVOKABLE void setCollision(int x, int y, int collision, bool forceRedraw = true, bool commitChanges = true); Q_INVOKABLE int getElevation(int x, int y); @@ -64,9 +66,15 @@ public: Q_INVOKABLE QJSValue getDimensions(); Q_INVOKABLE int getWidth(); Q_INVOKABLE int getHeight(); + Q_INVOKABLE QJSValue getBorderDimensions(); + Q_INVOKABLE int getBorderWidth(); + Q_INVOKABLE int getBorderHeight(); Q_INVOKABLE void setDimensions(int width, int height); Q_INVOKABLE void setWidth(int width); Q_INVOKABLE void setHeight(int height); + Q_INVOKABLE void setBorderDimensions(int width, int height); + Q_INVOKABLE void setBorderWidth(int width); + Q_INVOKABLE void setBorderHeight(int height); Q_INVOKABLE void clearOverlay(int layer = 0); Q_INVOKABLE void clearOverlays(); Q_INVOKABLE void hideOverlay(int layer = 0); diff --git a/src/mainwindow_scriptapi.cpp b/src/mainwindow_scriptapi.cpp index 5875bb08..d2281a9d 100644 --- a/src/mainwindow_scriptapi.cpp +++ b/src/mainwindow_scriptapi.cpp @@ -88,6 +88,18 @@ void MainWindow::setMetatileId(int x, int y, int metatileId, bool forceRedraw, b this->tryRedrawMapArea(forceRedraw); } +int MainWindow::getBorderMetatileId(int x, int y) { + if (!this->editor || !this->editor->map) + return 0; + // TODO +} + +void MainWindow::setBorderMetatileId(int x, int y, int metatileId, bool forceRedraw, bool commitChanges) { + if (!this->editor || !this->editor->map) + return; + // TODO +} + int MainWindow::getCollision(int x, int y) { if (!this->editor || !this->editor->map) return 0; @@ -198,6 +210,24 @@ int MainWindow::getHeight() { return this->editor->map->getHeight(); } +QJSValue MainWindow::getBorderDimensions() { + if (!this->editor || !this->editor->map) + return QJSValue(); + // TODO +} + +int MainWindow::getBorderWidth() { + if (!this->editor || !this->editor->map) + return 0; + // TODO +} + +int MainWindow::getBorderHeight() { + if (!this->editor || !this->editor->map) + return 0; + // TODO +} + void MainWindow::setDimensions(int width, int height) { if (!this->editor || !this->editor->map) return; @@ -228,6 +258,24 @@ void MainWindow::setHeight(int height) { this->onMapNeedsRedrawing(); } +void MainWindow::setBorderDimensions(int width, int height) { + if (!this->editor || !this->editor->map) + return; + // TODO +} + +void MainWindow::setBorderWidth(int width) { + if (!this->editor || !this->editor->map) + return; + // TODO +} + +void MainWindow::setBorderHeight(int height) { + if (!this->editor || !this->editor->map) + return; + // TODO +} + void MainWindow::clearOverlay(int layer) { if (!this->ui || !this->ui->graphicsView_Map) return;