public GlyphPart(Boolean[,] raw)
            : this()
        {
            if (raw.GetLength(0) != 3 || raw.GetLength(1) != 3)
                throw new ArgumentException("Expecting a 3x3 boolean array");

            data = Rotate(raw);
        }
 public static Point[] CalculateCollisionPixeslForTextureSheetCell(Boolean[,] collisionBooleans)
 {
     List<Point> collisionPointsList = new List<Point>();
     for (Int32 x = 0; x < collisionBooleans.GetLength(0); x++) {
         for (Int32 y = 0; y < collisionBooleans.GetLength(1); y++) {
             if (collisionBooleans[x, y]) {
                 collisionPointsList.Add(new Point(x, y));
             }
         }
     }
     return collisionPointsList.ToArray();
 }
Exemple #3
0
 public static Texture2D Convert(GraphicsDevice device, Boolean[,] arrayToConvert)
 {
     // create a 1D array of colors so that we can turn the array into a Texture;
     int aWidth = arrayToConvert.GetLength(0);
     int aLength = arrayToConvert.GetLength(1);
     Color[] colorArray = new Color[aLength * aWidth];
     for (int x = 0; x < aWidth; x++)
     {
         for (int y = 0; y < aLength; y++)
         {
             if (arrayToConvert[x, y]) colorArray[x + (y * aLength)] = Color.Black;
             else colorArray[x + (y * aLength)] = Color.White;
         }
     }
     Texture2D mazeTexture = new Texture2D(device, aWidth, aLength, false, SurfaceFormat.Color);
     mazeTexture.SetData(colorArray);
     return mazeTexture;
 }