Add basic border functions to API

This commit is contained in:
GriffinR 2022-08-28 21:45:52 -04:00
parent 0fa71dc4c8
commit 8f90ca64b4
2 changed files with 56 additions and 0 deletions

View file

@ -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);

View file

@ -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;