Created
December 20, 2022 11:46
-
-
Save unitycoder/e1d28c19fc205ab8c32c4e5271a6abdc to your computer and use it in GitHub Desktop.
Draw 2D Grid (without If's or Ternary)
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
| int size = 10; | |
| for (int x = 0; x < window_width; x++) | |
| { | |
| for (int y = 0; y < window_height; y++) | |
| { | |
| int i = window_width * y + x; | |
| //color_buffer[i] = (x % size) * (y % size) ? 0x00000000 : 0xFFFFFFFF; | |
| color_buffer[i] = ~(1 - (x % size) * (y % size)) & 0xFFFFFFFF; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment