using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; namespace Sledgemapper { internal class SpriteSheet { internal Texture2D Texture; internal Dictionary index; public void LoadContent(ContentManager content, string spriteIndex, string texture) { index = content.Load>(spriteIndex); Texture = content.Load(texture); } internal Rectangle? SourceRectangle(string spriteName) { Rectangle r; bool hasValue = index.TryGetValue(spriteName, out r); if (hasValue) { return r; } else { throw new Exception("value doesn't exist"); } } } }