// Clear (draw black) 9x9 square void Board::clearPoint(int xPoint, int yPoint){ TFTscreen.stroke(0, 0, 0); for(int i = -3; i <= 3; i++){ for(int j = -3; j <= 3; j++){ TFTscreen.point(xPoint + i, yPoint + j); } } }
// Draw a 9x9 pellet void Board::drawPellet(Pellet pellet){ TFTscreen.stroke(56, 3, 200); for(int i = -3; i <= 3; i++){ for(int j = -3; j <= 3; j++){ TFTscreen.point(pellet.xPos + i, pellet.yPos + j); } } TFTscreen.stroke(0,0,0); }
// Draws snake body as single point(1 pixel) void Board::drawPointFast(uint8_t xPoint, uint8_t yPoint){ // Set new stroke TFTscreen.stroke(rgbColour[0], rgbColour[1], rgbColour[2]); // Draw 9x9 square TFTscreen.point(xPoint, yPoint); // Set new colors updateColors(); }
// Draws a 9X9 point with (xPoint, yPoint) as center void Board::drawPoint(uint8_t xPoint, uint8_t yPoint){ // set new stroke TFTscreen.stroke(rgbColour[0], rgbColour[1], rgbColour[2]); //Draw 9x9 square for(int i = -3; i <= 3; i++){ for(int j = -3; j <= 3; j++){ TFTscreen.point(((int)xPoint) + i, ((int)yPoint) + j); } } // Set new colors updateColors(); }
// Draws pellet as only the middle pixel void Board::drawPelletFast(Pellet pellet){ TFTscreen.stroke(56, 3, 200); TFTscreen.point(pellet.xPos, pellet.yPos); TFTscreen.stroke(0,0,0); }
// Clear (draw black) single point (1 pixel) void Board::clearPointFast(int xPoint, int yPoint){ TFTscreen.stroke(0, 0, 0); TFTscreen.point(xPoint, yPoint); }