Skip to content

Instantly share code, notes, and snippets.

@thisisjofrank
Created May 22, 2020 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisisjofrank/9866311bf816a9c214919acf6ece9780 to your computer and use it in GitHub Desktop.
Save thisisjofrank/9866311bf816a9c214919acf6ece9780 to your computer and use it in GitHub Desktop.
reverse every other line of the array
// 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