public Texture2D GetTexture(SmileyTexture texture) { if (!_textures.ContainsKey(texture)) { PreCacheTextures(texture); } return(_textures[texture]); }
/// <summary> /// Constructs a new TileSet. /// </summary> /// <param name="texture"></param> /// <param name="numTiles"></param> /// <param name="rect"></param> /// <param name="hotSpot"></param> public SpriteSet(SmileyTexture texture, int numTiles, Rectangle rect, Vector2?hotSpot = null) { //Defer creating the tile sprites until they are accessed, because we need the texture height/width //to compute the sprites and they might not be loaded yet! _texture = texture; _numTiles = numTiles; _rect = rect; _hotSpot = hotSpot; }
/// <summary> /// Constructs a new Sprite. /// </summary> /// <param name="texture"></param> /// <param name="rect"></param> /// <param name="hotSpot"></param> public Sprite(SmileyTexture texture, Rectangle?rect, Vector2 hotSpot) { Texture = texture; Rect = rect; HotSpot = hotSpot; }
/// <summary> /// Constructs a new Sprite. /// </summary> /// <param name="texture"></param> /// <param name="rect"></param> public Sprite(SmileyTexture texture, Rectangle?rect) : this(texture, rect, new Vector2(0, 0)) { }
/// <summary> /// Constructs a new Animation. /// </summary> /// <param name="texture"></param> /// <param name="rect"></param> /// <param name="numFrames"></param> /// <param name="fps"></param> /// <param name="hotSpot"></param> /// <param name="reverse"></param> /// <param name="loop"></param> /// <param name="pingPong"></param> public Animation(SmileyTexture texture, Rectangle rect, int numFrames, float fps, Vector2?hotSpot = null, bool reverse = false, bool loop = false, bool pingPong = false) : this(new SpriteSet(texture, numFrames, rect, hotSpot), fps, reverse, loop, pingPong) { }