public NonAnimatedSprite(Texture2D spriteSheet, SpriteSheetInfo info) { sourceSpriteSheet = spriteSheet; SetSpriteScreenSize(info.XSize, info.YSize); //Set our source rectangle size to be the whole sprite by default sourceRectangle = new Rectangle(Zero, Zero, spriteSheet.Width, spriteSheet.Height); }
public AnimatedSprite(Texture2D spriteSheet, SpriteSheetInfo info) : base(spriteSheet, info) { sourceSpriteSheetColumns = info.Columns; sourceSpriteSheetRows = info.Rows; animationFPS = info.AnimationFPS; //Calculate an individual sprite size on the source sheet based on our number of rows and columns SourceRectangle = new Rectangle(SourceRectangle.X, SourceRectangle.Y, SourceSpriteSheet.Width / sourceSpriteSheetColumns, SourceSpriteSheet.Height / sourceSpriteSheetRows); totalFrames = info.Columns * info.Rows; }