本文整理匯總了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);
}