Пример #1
0
        private void DrawSprites(Device device, SpriteBatch spritebatch, Rectangle cliprectangle)
        {
            try
            {
                DxTexture texture = _texture;
                if (texture == null)
                    return;

                spritebatch.Begin();
                try
                {
                    int width = Math.Min(texture.Descriptor2D.Width, cliprectangle.Width);
                    int height = Math.Min(texture.Descriptor2D.Height, cliprectangle.Height);
                    Rectangle rectangle = new Rectangle(cliprectangle.X, cliprectangle.Y, width, height);
                    texture.Draw(device, spritebatch, Vector2.Zero, rectangle, 1.0f);
                }
                finally
                {
                    spritebatch.End();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }