public AnimatingSprite(ContentManager content, string textureName, Point frameDimensions, Vector2 sourceOffset) : this() { //check for bad frame dimensions when building this way if (frameDimensions.X <= 0 || frameDimensions.Y <= 0) { throw new Exception($"Frame dimension of {{{frameDimensions.X}, {{{frameDimensions.Y}}} is invalid."); } //get the texture name TextureName = textureName; //get the source offset SourceOffset = sourceOffset; //grab the frame dimensions FrameDimensions = frameDimensions; //load the texture Texture = content.Load <Texture2D>(TextureFilename.GetRelPathFileNoExt()); //set the frames per row FramesPerRow = Texture.Width / FrameDimensions.X; }
public void LoadContent(ContentManager content) { Texture = content.Load <Texture2D>(TextureFilename.GetRelPathFileNoExt()); }