int main(void) { //init stepper(BOTH,VOR,0);// initalize so that the global pointers are initialized for the turtle()-function /* turtle_t *commands; int commandNumber; parseCommandFile(FILEPATH, &commands, &commandNumber); do_it(commands,commandNumber); free(commands);*/ lawnmower(); return 0; }
void GameDisplay::setLevel(int i)//sets up the grid based on level { QPen grid=QPen(Qt::black);// QBrush dirt(QColor(102,51,0));// handles the colors of the grid QBrush grass(QColor(0,153,0));// QBrush lawnmower(QColor(160,160,160));// for(int row=0;row<500;row+=100) { scene()->addRect(0,row,90,100,grid,lawnmower); } switch(i) { case 1://sets 1 row of grass, rest is dirt for(int column=90;column<900;column+=90) { scene()->addRect(column,0,90,100,grid,dirt); } for(int column=90;column<900;column+=90) { scene()->addRect(column,100,90,100,grid,dirt); } for(int column=90;column<900;column+=90) { scene()->addRect(column,200,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,300,90,100,grid,dirt); } for(int column=90;column<900;column+=90) { scene()->addRect(column,400,90,100,grid,dirt); } l = new Lawnmower(0,200); lawnmowerVector.push_back(l); scene()->addItem(l); break; case 3://sets middle 3 rows of grass, rest is dirt for(int column=90;column<900;column+=90) { scene()->addRect(column,0,90,100,grid,dirt); } for(int column=90;column<900;column+=90) { scene()->addRect(column,100,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,200,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,300,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,400,90,100,grid,dirt); } l = new Lawnmower(0,100); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,200); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,300); lawnmowerVector.push_back(l); scene()->addItem(l); break; case 5://sets 5 rows of grass for(int column=90;column<900;column+=90) { scene()->addRect(column,0,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,100,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,200,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,300,90,100,grid,grass); } for(int column=90;column<900;column+=90) { scene()->addRect(column,400,90,100,grid,grass); } l = new Lawnmower(0,0); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,100); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,200); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,300); lawnmowerVector.push_back(l); scene()->addItem(l); l = new Lawnmower(0,400); lawnmowerVector.push_back(l); scene()->addItem(l); break; } setGridFromLevel(); }