Render() public method

Renders a surface to the screen.
public Render ( ITextSurfaceRendered surface, Matrix renderingMatrix ) : void
surface ITextSurfaceRendered The surface to render.
renderingMatrix Matrix Display matrix for the rendered console.
return void
        /// <summary>
        /// Updates the cache based on the <paramref name="source"/> surface.
        /// </summary>
        /// <param name="source">The surface to render and cache.</param>
        public void Update(ITextSurfaceRendered source)
        {
#if SFML
            if (renderedConsole != null && renderedConsole.Size.X != (uint)source.AbsoluteArea.Width && renderedConsole.Size.Y != (uint)source.AbsoluteArea.Height)
            {
                renderedConsole.Dispose();
                renderedConsole = new RenderTexture((uint)source.AbsoluteArea.Width, (uint)source.AbsoluteArea.Height, false);
            }
            else if (renderedConsole == null)
            {
                renderedConsole = new RenderTexture((uint)source.AbsoluteArea.Width, (uint)source.AbsoluteArea.Height, false);
            }

            renderedConsole.Clear(Color.Transparent);
            TextSurfaceRenderer renderer = new TextSurfaceRenderer();
            //renderer.CallBatchEnd = false;
            //renderer.AfterRenderCallback = (batch) => batch.End(renderedConsole, RenderStates.Default);
            renderer.AlternativeRenderTarget = renderedConsole;
            renderer.Render(source, new Vector2i(0, 0));
            renderedConsole.Display();
#elif MONOGAME
            if (renderedConsole != null)
            {
                renderedConsole.Dispose();
            }

            renderedConsole = new RenderTarget2D(Engine.Device, source.AbsoluteArea.Width, source.AbsoluteArea.Height, false, Engine.Device.DisplayMode.Format, DepthFormat.Depth24);
            Engine.Device.SetRenderTarget(renderedConsole);
            Engine.Device.Clear(Color.Transparent);
            TextSurfaceRenderer renderer = new TextSurfaceRenderer();
            renderer.Render(source, new Point(0, 0));
            Engine.RestoreRenderTarget();
#endif
        }
示例#2
0
        /// <summary>
        /// Updates the cache based on the <paramref name="source"/> surface.
        /// </summary>
        /// <param name="source">The surface to render and cache.</param>
        public void Update(ITextSurfaceRendered source)
        {
            if (renderedConsole != null)
            {
                renderedConsole.Dispose();
            }

            renderedConsole = new RenderTarget2D(Engine.Device, source.AbsoluteArea.Width, source.AbsoluteArea.Height, false, Engine.Device.DisplayMode.Format, DepthFormat.Depth24);
            Engine.Device.SetRenderTarget(renderedConsole);
            Engine.Device.Clear(Color.Transparent);
            TextSurfaceRenderer renderer = new TextSurfaceRenderer();

            renderer.Render(source, new Point(0, 0));
            Engine.RestoreRenderTarget();
        }
        /// <summary>
        /// Updates the cache based on the <paramref name="source"/> surface.
        /// </summary>
        /// <param name="source">The surface to render and cache.</param>
        public void Update(ITextSurfaceRendered source)
        {
            if (renderedConsole != null)
                renderedConsole.Dispose();

            renderedConsole = new RenderTarget2D(Engine.Device, source.AbsoluteArea.Width, source.AbsoluteArea.Height, false, Engine.Device.DisplayMode.Format, DepthFormat.Depth24);
            Engine.Device.SetRenderTarget(renderedConsole);
            Engine.Device.Clear(Color.Transparent);
            TextSurfaceRenderer renderer = new TextSurfaceRenderer();
            renderer.Render(source, new Point(0, 0));
            Engine.RestoreRenderTarget();
        }