Skip to content

Instantly share code, notes, and snippets.

@felipecustodio
Created December 1, 2018 06:36
Show Gist options
  • Select an option

  • Save felipecustodio/d086e595ba139820c5fae9577057b077 to your computer and use it in GitHub Desktop.

Select an option

Save felipecustodio/d086e595ba139820c5fae9577057b077 to your computer and use it in GitHub Desktop.
Draw chess pattern grid
void drawGrid() {
push();
stroke(0);
boolean switch_color = false;
for (int line = 0; line <= width; line += cell_size) {
for (int column = 0; column <= height; column += cell_size) {
if (switch_color) {
fill(255);
switch_color = false;
} else {
fill(0);
switch_color = true;
}
rect(line, column, cell_size, cell_size);
// rect(line, cell_size, width - cell_size, spacing);
// line += spacing;
// fill(255, 0, 0);
}
}
pop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment