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); }
public virtual Rectangle GetFrame(Texture2D texture) { return texture.Frame(1, 1, 0, 0); }
public override Rectangle GetFrame(Texture2D texture) { return texture.Frame(1, this.FrameCount, 0, this.Frame); }