a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- /// <summary>
- /// A rectangle telling us where to pull from the source texture when rendering.
- /// </summary>
- internal Rectangle currentFrameRect
- Vector2 rSize = new Vector2(texture.Width / Animation.sheetMatrix.X, texture.Height / Animation.sheetMatrix.Y);
- Vector2 rPos = new Vector2(0, 0);
- int cFrame = Animation.currentFrame;
- while (cFrame > Animation.sheetMatrix.X)
- cFrame -= (int)Animation.sheetMatrix.X;
- rPos.X = Math.Max((cFrame - 1), 0);
- return new Rectangle((int)(rPos.X * rSize.X), (int)(rPos.Y * rSize.Y), (int)(rSize.X), (int)(rSize.Y));
RAW Paste Data