Faster way to iterate through a jaggad array?
Posted
by George Johnston
on Stack Overflow
See other posts from Stack Overflow
or by George Johnston
Published on 2010-03-29T23:32:31Z
Indexed on
2010/03/29
23:33 UTC
Read the original article
Hit count: 374
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?
© Stack Overflow or respective owner