32 lines
697 B
C++
32 lines
697 B
C++
#include "map.h"
|
|
|
|
|
|
map::map(games *parent)
|
|
{
|
|
game = parent;
|
|
}
|
|
|
|
|
|
void map::clear()
|
|
{
|
|
QPainter painter(game->background);
|
|
QPen pen(QColor(150,150,150));
|
|
painter.setPen(pen);
|
|
painter.fillRect(game->background->rect(),QColor(150,150,150));
|
|
painter.end();
|
|
}
|
|
|
|
|
|
void map::drawgrid()
|
|
{
|
|
int i;
|
|
QPainter painter(game->background);
|
|
QPen pen(QColor(100,100,100));
|
|
painter.setPen(pen);
|
|
for (i = 0; i < game->background->width()/game->cellsize; i++)
|
|
painter.drawLine(i*game->cellsize,0,i*game->cellsize,game->background->height());
|
|
for (i = 0; i < game->background->height()/game->cellsize; i++)
|
|
painter.drawLine(0,i*game->cellsize,game->background->width(),i*game->cellsize);
|
|
painter.end();
|
|
}
|