getBackground method

int getBackground(
  1. int x,
  2. int y
)

Gets the background color at (x, y). Returns 0 if coordinates are out of bounds.

Implementation

int getBackground(int x, int y) {
  if (x < 0 || x >= width || y < 0 || y >= height) return 0;
  return attributes[(y * width + x) * 3 + 1];
}