Created
May 22, 2020 09:48
-
-
Save thisisjofrank/9866311bf816a9c214919acf6ece9780 to your computer and use it in GitHub Desktop.
reverse every other line of the array
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
// calculate x and y positioning of the pixel selected | |
auto y = pixel / 16; | |
auto shouldSnake = y % 2 == 0; | |
auto prevPixels = y * 16; | |
auto regularX = (pixel % 16); | |
auto snakeX = (15 - regularX); | |
auto x = shouldSnake ? snakeX : regularX; | |
auto snakePixelId = x + (lineOffset); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment