public WidgetRenderContext(
     GraphicsDevice graphicsDevice,
     ILocalizedContentLayoutEngine contentLayoutEngine,
     IUserInterfaceRenderer uiRenderer,
     IStyleConfigurator styleConfigurator,
     RenderTarget2D renderTarget = null,
     SpriteBatch spriteBatch     = null,
     IDoubleBuffer doubleBuffer  = null)
 {
     this.GraphicsDevice        = graphicsDevice;
     this.contentLayoutEngine   = contentLayoutEngine;
     this.UserInterfaceRenderer = uiRenderer;
     this.StyleConfigurator     = styleConfigurator;
     this.RenderTarget          = renderTarget;
     this.SpriteBatch           = spriteBatch ?? new SpriteBatch(graphicsDevice);
     this.DoubleBuffer          = doubleBuffer ?? new DoubleBuffer();
 }
        public WidgetRenderContext(WidgetRenderContext parent,
                                   SpriteBatch spriteBatch,
                                   RenderTarget2D renderTarget)
        {
            this.GraphicsDevice = parent.GraphicsDevice;
            this.SpriteBatch    = spriteBatch;
            this.RenderTarget   = renderTarget;

            this.contentLayoutEngine   = parent.contentLayoutEngine;
            this.GameTime              = parent.GameTime;
            this.UserInterfaceRenderer = parent.UserInterfaceRenderer;
            this.DoubleBuffer          = parent.DoubleBuffer;

            this.lastParentWidget  = parent.lastParentWidget;
            this.WorkspaceIsActive = parent.WorkspaceIsActive;

            this.parentRenderContext = parent;
        }
Example #3
0
        public UserInterfaceScene(GraphicsDevice graphicsDevice,
                                  IUserInterfaceRenderer userInterfaceRenderer,
                                  ILocalizedContentLayoutEngine contentLayoutEngine,
                                  IStyleConfigurator styleConfigurator,
                                  IDoubleBuffer doubleBuffer  = null,
                                  RenderTarget2D renderTarget = null)
        {
            DrawBelow   = true;
            UpdateBelow = false;

            renderContext = new WidgetRenderContext(
                graphicsDevice,
                contentLayoutEngine,
                userInterfaceRenderer,
                styleConfigurator,
                renderTarget,
                null,
                doubleBuffer);

            driver = new UserInterfaceSceneDriver(renderContext);

            driver.Desktop.Empty += () =>
            {
                if (ExitWhenEmpty)
                {
                    IsFinished = true;
                }
            };

            BlendState = new BlendState
            {
                ColorSourceBlend      = Blend.SourceAlpha,
                ColorDestinationBlend = Blend.InverseSourceAlpha,
                AlphaSourceBlend      = Blend.One,
                AlphaDestinationBlend = Blend.InverseSourceAlpha,
            };
        }