Display grid lines on map editor

This commit is contained in:
Marcus Huderle 2018-03-04 16:07:52 -08:00
parent 6bb945d798
commit 47ce60cbe1
2 changed files with 15 additions and 0 deletions

View file

@ -156,6 +156,7 @@ void Editor::displayMap() {
displayMapObjects();
displayMapConnections();
displayMapBorder();
displayMapGrid();
}
void Editor::displayMetatiles() {
@ -244,6 +245,19 @@ void Editor::displayMapBorder() {
}
}
void Editor::displayMapGrid() {
int pixelWidth = map->getWidth() * 16;
int pixelHeight = map->getHeight() * 16;
for (int i = 0; i <= map->getWidth(); i++) {
int x = i * 16;
QGraphicsLineItem *line = scene->addLine(x, 0, x, pixelHeight);
}
for (int j = 0; j <= map->getHeight(); j++) {
int y = j * 16;
QGraphicsLineItem *line = scene->addLine(0, y, pixelWidth, y);
}
}
void MetatilesPixmapItem::paintTileChanged(Map *map) {
draw();
}

View file

@ -37,6 +37,7 @@ public:
void displayMapObjects();
void displayMapConnections();
void displayMapBorder();
void displayMapGrid();
void setEditingMap();
void setEditingCollision();