Example #1
0
        public UserInterfaceScene(GraphicsDevice graphicsDevice,
                                  IUserInterfaceRenderer userInterfaceRenderer,
                                  IContentLayoutEngine contentLayoutEngine,
                                  IFontProvider fontProvider,
                                  IStyleConfigurator styleConfigurator,
                                  IAnimationFactory animationFactory = null,
                                  IUserInterfaceAudio audio          = null,
                                  IDoubleBuffer doubleBuffer         = null,
                                  RenderTarget2D renderTarget        = null)
        {
            DrawBelow   = true;
            UpdateBelow = false;

            Animations     = animationFactory ?? new AnimationFactory();
            GraphicsDevice = graphicsDevice;

            renderContext = new UserInterfaceRenderContext(
                graphicsDevice,
                contentLayoutEngine,
                userInterfaceRenderer,
                styleConfigurator,
                fontProvider,
                Animations,
                renderTarget,
                null,
                doubleBuffer);

            driver = new UserInterfaceSceneDriver(
                renderContext,
                styleConfigurator,
                fontProvider,
                audio);

            driver.ScreenArea = new Rectangle(Point.Zero,
                                              GraphicsDeviceRenderTargetSize);

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

            BlendState = new BlendState
            {
                ColorSourceBlend      = Blend.SourceAlpha,
                ColorDestinationBlend = Blend.InverseSourceAlpha,
                AlphaSourceBlend      = Blend.One,
                AlphaDestinationBlend = Blend.InverseSourceAlpha,
            };
        }
Example #2
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,
            };
        }