Created
December 1, 2018 06:36
-
-
Save felipecustodio/d086e595ba139820c5fae9577057b077 to your computer and use it in GitHub Desktop.
Draw chess pattern grid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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