Example #1
0
 public override void Draw(UISpriteBatch batch)
 {
     if (!UISpriteBatch.Invalidated)
     {
         if (!_3DScene.IsInvalidated)
         {
             batch.Pause();
             Avatar.Draw(GameFacade.GraphicsDevice);
             batch.Resume();
         }
     }
 }
Example #2
0
 public override void PreDraw(UISpriteBatch batch)
 {
     base.PreDraw(batch);
     if (!UISpriteBatch.Invalidated)
     {
         if (!_3DScene.IsInvalidated)
         {
             batch.Pause();
             Scene.Draw(GameFacade.GraphicsDevice);
             batch.Resume();
             DrawLocalTexture(batch, Scene.Target, new Vector2());
         }
     }
 }
        public override void Draw(UISpriteBatch batch)
        {
            base.Draw(batch);
            var bg       = EditorComponent.EditorResource.Get().ViewBG;
            var viewport = GameFacade.GraphicsDevice.Viewport;
            var scale    = 1.0f;

            switch (TempVM.Context.World.State.Zoom)
            {
            case LotView.WorldZoom.Far:
                scale = 0.25f; break;

            case LotView.WorldZoom.Medium:
                scale = 0.5f; break;
            }

            DrawLocalTexture(batch, bg, null, new Vector2(viewport.Width / 2 - 400 * scale, viewport.Height / 2 - 300 * scale), new Vector2(scale, scale));
            batch.Pause();
            GameFacade.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            if (TempVM == null)
            {
                return;
            }

            if (TargetTile != null)
            {
                Vector2 rot = new Vector2();
                switch (TempVM.Context.World.State.Rotation)
                {
                case LotView.WorldRotation.TopLeft: rot = new Vector2(2.5f, 2.5f); break;

                case LotView.WorldRotation.TopRight: rot = new Vector2(2.5f, -2.5f); break;

                case LotView.WorldRotation.BottomRight: rot = new Vector2(-2.5f, -2.5f); break;

                case LotView.WorldRotation.BottomLeft: rot = new Vector2(-2.5f, 2.5f); break;
                }
                var tile = TargetTile.VisualPosition;
                TempVM.Context.World.State.CenterTile = new Vector2(tile.X, tile.Y) - rot;
            }

            var world = TempVM.Context.World;

            world.State.SetDimensions(new Vector2(viewport.Width, viewport.Height));
            world.PreDraw(GameFacade.GraphicsDevice);
            world.Draw(GameFacade.GraphicsDevice);
            GameFacade.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
            batch.Resume();
        }
Example #4
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);
         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!
 }
Example #5
0
 public override void Draw(UISpriteBatch batch)
 {
     batch.Pause();
     SimScene.Draw(GameFacade.GraphicsDevice);
     batch.Resume();
 }