示例#1
0
        /// <summary>Function called to render the sprite data.</summary>
        /// <returns>The presentation interval to use when rendering.</returns>
        protected override int OnRender()
        {
            DX.RectangleF textureRegion = _clipper.Rectangle;
            DX.RectangleF spriteRegion  = SpriteContent.Texture.ToTexel(textureRegion.ToRectangle());
            var           imageRegion   = new DX.RectangleF(0, 0, SpriteContent.Texture.Width, SpriteContent.Texture.Height);

            RenderSpriteTextureWithoutSprite(imageRegion, spriteRegion);

            SwapChain.RenderTargetView.Clear(BackgroundColor);

            Renderer.Begin();

            // Draw the pattern layer.
            RenderRect(imageRegion, GorgonColor.White, BackgroundPattern, new DX.RectangleF(0, 0, (imageRegion.Width * ZoomScaleValue) / BackgroundPattern.Width, (imageRegion.Height * ZoomScaleValue) / BackgroundPattern.Height));

            // Draw the image buffer layer.
            Renderer.DrawFilledRectangle(new DX.RectangleF(0, 0, SwapChain.Width, SwapChain.Height), new GorgonColor(GorgonColor.White, 0.5f), ImageBufferTexture, new DX.RectangleF(0, 0, 1, 1));

            RenderRect(textureRegion, GorgonColor.White, SpriteContent.Texture, SpriteContent.Texture.ToTexel(textureRegion.ToRectangle()), TextureArrayIndex, GorgonSamplerState.PointFiltering);

            if ((SpriteContent.ManualRectangleEditor != null) && (SpriteContent.ManualRectangleEditor.IsActive) && (SpriteContent.ManualRectangleEditor.IsMoving))
            {
                DrawDockRect();
            }

            _clipper.Render();

            Renderer.End();

            // When we're dragging, update the swap presentation faster so we reduce the lag from the mouse input.
            return(_clipper.IsDragging ? 0 : 1);
        }
        /// <summary>Function called to render the sprite data.</summary>
        /// <returns>The presentation interval to use when rendering.</returns>
        protected override int OnRender()
        {
            DX.RectangleF spriteRegion = _picker.Rectangle;
            var           imageRegion  = new DX.RectangleF(0, 0, SpriteContent.Texture.Width, SpriteContent.Texture.Height);

            RenderSpriteTextureWithoutSprite(imageRegion, spriteRegion);

            SwapChain.RenderTargetView.Clear(BackgroundColor);

            Renderer.Begin();

            // Draw the pattern layer.
            RenderRect(imageRegion, GorgonColor.White, BackgroundPattern, new DX.RectangleF(0, 0, (imageRegion.Width * ZoomScaleValue) / BackgroundPattern.Width, (imageRegion.Height * ZoomScaleValue) / BackgroundPattern.Height));
            // Draw the image buffer layer.
            Renderer.DrawFilledRectangle(new DX.RectangleF(0, 0, SwapChain.Width, SwapChain.Height), new GorgonColor(GorgonColor.White, 0.5f), ImageBufferTexture, new DX.RectangleF(0, 0, 1, 1));
            // Draw the sprite layer.
            RenderRect(spriteRegion, GorgonColor.White, SpriteContent.Texture, SpriteContent.Texture.ToTexel(spriteRegion.ToRectangle()), TextureArrayIndex, GorgonSamplerState.PointFiltering);

            _marchAnts.Draw(ToClient(spriteRegion));

            Renderer.End();

            return(1);
        }