本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Texture2D.Frame方法的典型用法代码示例。如果您正苦于以下问题:C# Texture2D.Frame方法的具体用法?C# Texture2D.Frame怎么用?C# Texture2D.Frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.Texture2D
的用法示例。
在下文中一共展示了Texture2D.Frame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawFilling
private void DrawFilling(SpriteBatch spritebatch, Texture2D tex, Texture2D texShadow, Vector2 topLeft, int completedWidth, int totalWidth, Color separator, Color empty)
{
if (completedWidth % 2 != 0)
{
completedWidth--;
}
Vector2 position = topLeft + (float)completedWidth * Vector2.UnitX;
int i = completedWidth;
Rectangle value = tex.Frame(1, 1, 0, 0);
while (i > 0)
{
if (value.Width > i)
{
value.X += value.Width - i;
value.Width = i;
}
spritebatch.Draw(tex, position, new Rectangle?(value), Color.White, 0f, new Vector2((float)value.Width, 0f), 1f, SpriteEffects.None, 0f);
position.X -= (float)value.Width;
i -= value.Width;
}
if (texShadow != null)
{
spritebatch.Draw(texShadow, topLeft, new Rectangle?(new Rectangle(0, 0, completedWidth, texShadow.Height)), Color.White);
}
spritebatch.Draw(Main.magicPixel, new Rectangle((int)topLeft.X + completedWidth, (int)topLeft.Y, totalWidth - completedWidth, tex.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), empty);
spritebatch.Draw(Main.magicPixel, new Rectangle((int)topLeft.X + completedWidth - 2, (int)topLeft.Y, 2, tex.Height), new Rectangle?(new Rectangle(0, 0, 1, 1)), separator);
}
示例2: GetFrame
public virtual Rectangle GetFrame(Texture2D texture)
{
return texture.Frame(1, 1, 0, 0);
}
示例3: GetFrame
public override Rectangle GetFrame(Texture2D texture)
{
return texture.Frame(1, this.FrameCount, 0, this.Frame);
}