Faster way to iterate through a jagged array?
- by George Johnston
I would like to iterate through an array that covers every pixel on my screen. i.e:
for (int y = 598; y > 0; y--)
{
for (int x = 798; x > 0; x--)
{
if (grains[x][y])
{
spriteBatch.Draw(Grain, new Vector2(x,y), Color.White);
}
}
}
...my texture is a 1x1 pixel image that is drawn to the screen when the array value is true. It runs decent -- but there is definitely lag the more screen I cover. Is there a better way to accomplish what I am trying to achieve?