Advertisement
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
- {
- get
- {
- 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.Y++;
- }
- 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));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement