本文整理汇总了C#中System.Boolean.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Boolean.GetLength方法的具体用法?C# Boolean.GetLength怎么用?C# Boolean.GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Boolean
的用法示例。
在下文中一共展示了Boolean.GetLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GlyphPart
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);
}
示例2: CalculateCollisionPixeslForTextureSheetCell
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();
}
示例3: Convert
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;
}