本文整理汇总了C#中Microsoft.Xna.Framework.Rectangle.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.GetLength方法的具体用法?C# Rectangle.GetLength怎么用?C# Rectangle.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Rectangle
的用法示例。
在下文中一共展示了Rectangle.GetLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setDestinations
// setDestinations fills an array with rectangle positions
// Allows for easy fill of destination based on values.
private void setDestinations(Rectangle[,] array, Texture2D image, int startX, int startY, int buffer)
{
int width = image.Width;
int height = image.Height;
int y = startY + buffer;
for (int i = 0; i < array.GetLength(0); ++i) {
int x = startX + buffer;
for (int j = 0; j < array.GetLength(0); ++j) {
array[i, j] = new Rectangle(x, y, width, height);
if (j == 2 || j == 5) {
x += 10;
}
x += width + (buffer * 2);
}
if (i == 2 || i == 5) {
y += 10;
}
y += height + (buffer * 2);
}
}
示例2: setImageDimensions
/// <summary>
/// Set the imageDimensions for this GameTexture
/// </summary>
/// <param name="dims">Array of Rectangles representing each image's dimension</param>
public void setImageDimensions(Rectangle[] dims)
{
Array.Copy(dims, imageDimensions_, dims.GetLength(0));
}
示例3: drawFromArray
private void drawFromArray(Texture2D image, Rectangle[,] array)
{
for (int i = 0; i < array.GetLength(0); ++i) {
for (int j = 0; j < array.GetLength(1); ++j) {
spriteBatch.Draw(image, array[i, j], Color.White);
}
}
}