// grid.cpp definitions of the Grid class functions #include "grid.h" #include "gp142.h" // constructor Grid::Grid(GP142Display *display) { this->display = display; // set all rows of grid to empty for (int x=0; xdrawRectangle(GRID_LEFT-5,GRID_BOTTOM, GRID_LEFT-1,GRID_BOTTOM+GRID_HEIGHT*SQUARE_HEIGHT, Red, FILL); // bottom of grid display->drawRectangle(GRID_LEFT-5,GRID_BOTTOM-1, GRID_LEFT + GRID_WIDTH*SQUARE_WIDTH+5, GRID_BOTTOM-5, Blue, FILL); // right side of grid display->drawRectangle(GRID_LEFT+GRID_WIDTH*SQUARE_WIDTH+1,GRID_BOTTOM, GRID_LEFT+GRID_WIDTH*SQUARE_WIDTH+5,GRID_BOTTOM+GRID_HEIGHT*SQUARE_HEIGHT, Red, FILL); // all the grid squares for (int x=0; xdrawRectangle(GRID_LEFT+x*SQUARE_WIDTH,GRID_BOTTOM+y*SQUARE_HEIGHT, GRID_LEFT+(x+1)*SQUARE_WIDTH, GRID_BOTTOM+(y+1)*SQUARE_HEIGHT, grid[x][y],FILL); } // set the grid (x,y) to color void Grid::Set(int x, int y, GP142Color color) { grid[x][y] = color; } // check for and remove all solid rows of squares // if a solid row is found, all rows above it // are moved down and the top row set to empty void Grid::CheckRows() { // implementation needed }