Hello i'm doing a game in WPF, 2D version (top view)
I have the map and i'm trying to check for color collision in pixel each time the timer is activated
Well...with 1 object it works fine but with more objects at same time it just slow down the process
This is my code every time the dispatchertimer activates and i loop to check for collision on every object
CroppedBitmap cb = new CroppedBitmap(source, new Int32Rect(x, y, 1, 1));
int px = 1 * (source.Format.BitsPerPixel / 8);
byte[] pixels = new byte[px * 1];
cb.CopyPixels(pixels, px, 0);
Color c = Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
if (c.R == 255 && c.B == 255 && c.G == 255) {
pixels = null;
return true;
}
Any help to simplify the process? I really want to do it in WPF
PS: The map is 1018x731