Ejemplo n.º 1
0
        public UIRenderPlane(UISpriteBatch batch, Promise <Texture2D> texture)
        {
            this.GD      = batch.GraphicsDevice;
            this.Target  = batch.GetBuffer();
            this.Texture = texture;
            this.Batch   = batch;

            //GD.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;

            /** Switch the render target **/
            Batch.Pause();
            GD.SetRenderTarget(0, Target);
            GD.Clear(Color.TransparentBlack);
            Batch.Resume();

            /**
             *  batch.Pause();
             *  var buffer = batch.GetBuffer();
             *  var gd = GameFacade.GraphicsDevice;
             *
             *  var renderTarget = gd.GetRenderTarget(0);
             *  gd.SetRenderTarget(0, buffer);
             *  batch.Resume();
             *  gd.render
             *  //gd.Clear(Color.TransparentBlack);**/
        }
        public UIRenderPlane(UISpriteBatch batch, Promise<Texture2D> texture)
        {
            this.GD = batch.GraphicsDevice;
            this.Target = batch.GetBuffer();
            this.Texture = texture;
            this.Batch = batch;

            //GD.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;

            /** Switch the render target **/
            Batch.Pause();
            GD.SetRenderTarget(0, Target);
            GD.Clear(Color.TransparentBlack);
            Batch.Resume();

            /**
                batch.Pause();
                var buffer = batch.GetBuffer();
                var gd = GameFacade.GraphicsDevice;

                var renderTarget = gd.GetRenderTarget(0);
                gd.SetRenderTarget(0, buffer);
                batch.Resume();
                gd.render
                //gd.Clear(Color.TransparentBlack);**/
        }
Ejemplo n.º 3
0
        public void Dispose()
        {
            if (!UISpriteBatch.Invalidated)
            {
                Batch.Pause();

                GD.SetRenderTarget(0, null);
                Texture.SetValue(Target.GetTexture());
                Batch.Resume();

                Batch.FreeBuffer(Target);
            }
        }
Ejemplo n.º 4
0
        public UIRenderPlane(UISpriteBatch batch, Promise<Texture2D> texture)
        {
            this.GD = batch.GraphicsDevice;
            this.Target = batch.GetBuffer();
            this.Texture = texture;
            this.Batch = batch;

            /** Switch the render target **/
            Batch.Pause();
            GD.SetRenderTarget(0, Target);
            GD.Clear(Color.TransparentBlack);
            Batch.Resume();
        }
Ejemplo n.º 5
0
        public UIRenderPlane(UISpriteBatch batch, Promise <Texture2D> texture)
        {
            this.GD      = batch.GraphicsDevice;
            this.Target  = batch.GetBuffer();
            this.Texture = texture;
            this.Batch   = batch;

            if (!UISpriteBatch.Invalidated)
            {
                /** Switch the render target **/
                Batch.Pause();
                GD.SetRenderTarget(0, Target);
                GD.Clear(Color.TransparentBlack);
                Batch.Resume();
            }
        }
Ejemplo n.º 6
0
        public void Dispose()
        {
            Batch.Pause();

            GD.SetRenderTarget(0, null);
            Texture.SetValue(Target.GetTexture());
            Batch.Resume();

            /**
             *  batch.Pause();
             *  gd.SetRenderTarget(0, (RenderTarget2D)renderTarget);
             *  batch.FreeBuffer(buffer);
             *
             **/

            Batch.FreeBuffer(Target);
        }
Ejemplo n.º 7
0
 public override void Draw(UISpriteBatch batch)
 {
     if (!UISpriteBatch.Invalidated)
     {
         if (!_3DScene.IsInvalidated)
         {
             batch.Pause();
             Avatar.Draw(GameFacade.GraphicsDevice);
             batch.Resume();
         }
     }
 }
Ejemplo n.º 8
0
 public override void Draw(UISpriteBatch batch)
 {
     base.Draw(batch);
     if (m_CurrentItem == m_PieTree)
     {
         //var oldd = GameFacade.GraphicsDevice.DepthStencilBuffer;
         //GameFacade.GraphicsDevice.DepthStencilBuffer = new DepthStencilBuffer(GameFacade.GraphicsDevice, oldd.Width, oldd.Height, oldd.Format);
         //todo: how to do this in xna4...
         GameFacade.GraphicsDevice.Clear(ClearOptions.DepthBuffer, new Vector4(0), 16777215, 0); //use a temp depth buffer for drawing this... this is an awful idea but will do until we get a better 3D UI element drawing system.
         batch.Pause();
         m_Head.Draw(GameFacade.GraphicsDevice);
         batch.Resume();
         //GameFacade.GraphicsDevice.DepthStencilBuffer = oldd;
     } //if we're top level, draw head!
 }
Ejemplo n.º 9
0
 public override void Draw(UISpriteBatch batch)
 {
     batch.Pause();
     SimScene.Draw(GameFacade.GraphicsDevice);
     batch.Resume();
 }