Esempio n. 1
0
        /// <summary>
        /// Draws a Sprite primitive without starting a new SpriteBatch draw operation.
        /// </summary>
        /// <param name="sprite"></param>
        private void DrawBlockSpriteThin(TextureSprite sprite)
        {
            Color color = sprite.TintColor.ToXNAColor();
            color.A     = (byte)(color.A * sprite.Opacity);

            XNAImageResource resource = sprite.Resource as XNAImageResource;
            spriteBatch.Draw(resource,
                new Rectangle((int)sprite.Position.X, (int)sprite.Position.Y,(int)sprite.Size.X, (int)sprite.Size.Y),
                new Rectangle((int)sprite.SourcePosition.X, (int)sprite.SourcePosition.Y, (int)sprite.SourceSize.X, (int)sprite.SourceSize.Y),
                color);
        }
Esempio n. 2
0
 /// <summary>
 /// Draws the given sprite within its own SpriteBatch.Begin/End block.
 /// </summary>
 /// <param name="sprite"></param>
 private void DrawBlockSprite(TextureSprite sprite)
 {
     spriteBatch.Begin();
     DrawBlockSpriteThin(sprite);
     spriteBatch.End();
 }