Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GridGameMain::drawGrid() {
- int gridSquareSize = 20;
- int gridWidth = ui->gridView->width() - gridSquareSize;
- int gridHeight = ui->gridView->height() - gridSquareSize;
- QPen gridPen(Qt::white); // grid color
- for (int x = 0; x <= ui->gridView->width(); x += gridSquareSize) {
- scene->addLine(x, gridSquareSize, x, gridHeight, gridPen);
- }
- for (int y = 0; y <= ui->gridView->height(); y += gridSquareSize) {
- scene->addLine(gridSquareSize, y, gridWidth, y, gridPen);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement