Exemple #1
0
 public void Draw()
 {
     _Window.Clear(Color.White);
     _GameLevel.Draw();
     _Player.Draw(_Window);
     foreach (Isopod isopod in _Isopods)
     {
         isopod.Draw(_Window);
     }
     foreach (Item item in _Items)
     {
         item.Draw(_Window);
     }
     foreach (Obstacle obstacle in _Obstacles)
     {
         obstacle.Draw(_Window);
     }
     SplashKit.DrawText(_Player.Health.ToString() + "%", Color.White, 188, 70);
     if (levelCount == 1)
     {
         _startMonument.Draw();
         if (_startMonument.HasPlayerNear(_Player))
         {
             SplashKit.DrawText("Monument De Butch: 'e'", Color.White, _startMonument.X - _startMonument.Width / 8, _startMonument.Y - _startMonument.Width / 8);
             if (SplashKit.KeyDown(KeyCode.EKey))
             {
                 SplashKit.DrawBitmap("ButchyHistory.png", _Window.Width / 20, _Window.Height / 20);
             }
         }
     }
     _Window.Refresh();
 }
        protected override void Draw()
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            if (_gridSnap.Enabled)
            {
                int vertCount = this.Size.Height / _gridSnap.GridHeight;
                int horCount  = this.Size.Width / _gridSnap.GridWidth;
                _spriteBatch.Begin();
                for (int i = 0; i < vertCount + 1; i++)
                {
                    _spriteBatch.Draw(_lineTexture, new Rectangle(0, i * _gridSnap.GridHeight, this.Size.Width, 1), Color.Gray);
                }
                for (int i = 0; i < horCount + 1; i++)
                {
                    _spriteBatch.Draw(_lineTexture, new Rectangle(i * _gridSnap.GridWidth, 0, 1, this.Size.Height), Color.Gray);
                }
                _spriteBatch.End();
            }

            if (_previewGameObject != null && DrawCurrentGameObject)
            {
                _previewGameObject.Camera.Position = -_mousePosition;
                _previewGameObject.Draw(GameTimer.GameTime);
                _previewGameObject.Camera.Position = Vector2.Zero;
            }

            if (_gameLevel != null)
            {
                _gameLevel.Draw(GameTimer.GameTime);
            }


            Matrix simProj = Matrix.CreateOrthographicOffCenter(0, ConvertUnits.ToSimUnits(this.Size.Width), ConvertUnits.ToSimUnits(this.Size.Height), 0, 0, 1);
            Matrix simView = _gameLevel.Camera.GetSimViewMatrix();

            _selectedItemsDisplay.DrawSelectedItems(ref simProj, ref simView);
            if (_debugView != null)
            {
                _debugView.RenderDebugData(ref simProj, ref simView);
            }
        }
 public static void DrawLevel()
 {
     presentLevel.Draw();
 }