Display grid lines on map editor
This commit is contained in:
parent
6bb945d798
commit
47ce60cbe1
2 changed files with 15 additions and 0 deletions
14
editor.cpp
14
editor.cpp
|
@ -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();
|
||||
}
|
||||
|
|
1
editor.h
1
editor.h
|
@ -37,6 +37,7 @@ public:
|
|||
void displayMapObjects();
|
||||
void displayMapConnections();
|
||||
void displayMapBorder();
|
||||
void displayMapGrid();
|
||||
|
||||
void setEditingMap();
|
||||
void setEditingCollision();
|
||||
|
|
Loading…
Reference in a new issue