Esempio n. 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,
            };
        }
 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 UserInterfaceRenderContext(
     GraphicsDevice graphicsDevice,
     IContentLayoutEngine contentLayoutEngine,
     IUserInterfaceRenderer uiRenderer,
     IStyleConfigurator styleConfigurator,
     IFontProvider fonts,
     IAnimationFactory animation,
     RenderTarget2D renderTarget = null,
     SpriteBatch spriteBatch     = null,
     IDoubleBuffer doubleBuffer  = null)
 {
     this.GraphicsDevice        = graphicsDevice;
     this.contentLayoutEngine   = contentLayoutEngine;
     this.UserInterfaceRenderer = uiRenderer;
     this.fonts            = fonts;
     this.animationFactory = animation;
     this.RenderTarget     = renderTarget;
     this.SpriteBatch      = spriteBatch ?? new SpriteBatch(graphicsDevice);
     this.DoubleBuffer     = doubleBuffer ?? new DoubleBuffer();
 }
Esempio n. 4
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,
            };
        }