コード例 #1
0
        /// <summary>
        /// Draw the sprite to the given destination rectangle.
        /// Overrides scaling settings.
        /// </summary>
        /// <param name="destRect"></param>
        public void Draw(Rectangle destRect)
        {
            if (mFrames.Count == 0)
            {
                return;
            }

            SpriteFrame current = (SpriteFrame)CurrentFrame;

            current.DisplaySize = destRect.Size;
            Surface surf = current.Surface;

            PointF alignment = Origin.CalcF(DisplayAlignment, DisplaySize);
            PointF rotation  = Origin.CalcF(RotationCenter, DisplaySize);

            surf.Alpha            = Alpha;
            surf.DisplayAlignment = DisplayAlignment;
            surf.RotationAngle    = RotationAngle;
            surf.RotationCenter   = RotationCenter;
            surf.Color            = Color;

            current.Draw(destRect.X - alignment.X, destRect.Y - alignment.Y,
                         rotation.X, rotation.Y);
        }