Browse Source

Display grid lines on map editor

Marcus Huderle 6 years ago
parent
commit
47ce60cbe1
2 changed files with 15 additions and 0 deletions
  1. 14
    0
      editor.cpp
  2. 1
    0
      editor.h

+ 14
- 0
editor.cpp View File

156
     displayMapObjects();
156
     displayMapObjects();
157
     displayMapConnections();
157
     displayMapConnections();
158
     displayMapBorder();
158
     displayMapBorder();
159
+    displayMapGrid();
159
 }
160
 }
160
 
161
 
161
 void Editor::displayMetatiles() {
162
 void Editor::displayMetatiles() {
244
     }
245
     }
245
 }
246
 }
246
 
247
 
248
+void Editor::displayMapGrid() {
249
+    int pixelWidth = map->getWidth() * 16;
250
+    int pixelHeight = map->getHeight() * 16;
251
+    for (int i = 0; i <= map->getWidth(); i++) {
252
+        int x = i * 16;
253
+        QGraphicsLineItem *line = scene->addLine(x, 0, x, pixelHeight);
254
+    }
255
+    for (int j = 0; j <= map->getHeight(); j++) {
256
+        int y = j * 16;
257
+        QGraphicsLineItem *line = scene->addLine(0, y, pixelWidth, y);
258
+    }
259
+}
260
+
247
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
261
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
248
     draw();
262
     draw();
249
 }
263
 }

+ 1
- 0
editor.h View File

37
     void displayMapObjects();
37
     void displayMapObjects();
38
     void displayMapConnections();
38
     void displayMapConnections();
39
     void displayMapBorder();
39
     void displayMapBorder();
40
+    void displayMapGrid();
40
 
41
 
41
     void setEditingMap();
42
     void setEditingMap();
42
     void setEditingCollision();
43
     void setEditingCollision();