Advertisement
BeamNG_IRC

Untitled

Sep 23rd, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1.  
  2. void GridGameMain::drawGrid() {
  3.  
  4.     int gridSquareSize = 20;
  5.     int gridWidth = ui->gridView->width() - gridSquareSize;
  6.     int gridHeight = ui->gridView->height() - gridSquareSize;
  7.     QPen gridPen(Qt::white); // grid color
  8.     for (int x = 0; x <= ui->gridView->width(); x += gridSquareSize) {
  9.  
  10.         scene->addLine(x, gridSquareSize, x, gridHeight, gridPen);
  11.  
  12.     }
  13.  
  14.     for (int y = 0; y <= ui->gridView->height(); y += gridSquareSize) {
  15.  
  16.         scene->addLine(gridSquareSize, y, gridWidth, y, gridPen);
  17.  
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement