Exemplo n.º 1
0
        /// <summary>
        /// Gets a SpriteSheet. If the SpriteSheet has been loaded before, that instance will be used, otherwise a new instance will be loaded.
        /// </summary>
        /// <param name="name">The name of the SpriteSheet.</param>
        /// <returns>The SpriteSheet.</returns>
        public SpriteSheet GetSpriteSheet(String name)
        {
            // Load if it hasn't been loaded yet
            if (!_SpriteSheets.ContainsKey(name)) {
                _SpriteSheets[name] = new SpriteSheet(name);
            }

            return _SpriteSheets[name];
        }
Exemplo n.º 2
0
 /// <summary>
 /// Draws a part of a SpriteSheet on the screen.
 /// </summary>
 /// <param name="position">The position to draw the extracted part at</param>
 /// <param name="size">The size of the extracted part.</param>
 /// <param name="cell">The cell of the SpriteSheet to extract.</param>
 /// <param name="spriteSheet">The SpriteSheet.</param>
 /// <param name="effects">Effects to apply to the texture.</param>
 public void DrawSpriteSheet(Vector2 position, Vector2 size, Point cell, SpriteSheet spriteSheet, Color? tint = null, SpriteEffects effects = SpriteEffects.None)
 {
     DrawTexture(position, 0F, size, spriteSheet.Texture, new RectangleF(cell.X * spriteSheet.CellSize.X, cell.Y * spriteSheet.CellSize.Y, spriteSheet.CellSize.X, spriteSheet.CellSize.Y), tint, effects);
 }