public void Draw(GameTime gameTime, Camera2D camera)
        {
            CurrentMap.Draw(gameTime, FinalBomber.Instance.SpriteBatch, camera);

            foreach (Wall wall in WallList)
            {
                wall.Draw(gameTime, camera);
            }

            foreach (PowerUp powerUp in PowerUpList)
            {
                powerUp.Draw(gameTime, camera);
            }

            foreach (Bomb bomb in BombList)
            {
                bomb.Draw(gameTime, camera);
            }

            Players.Sort(new PlayerOverlappingSort());
            foreach (Player player in Players)
            {
                if (player.IsAlive)
                {
                    player.Draw(gameTime);
                }
            }
        }
Exemple #2
0
        public void Draw(Microsoft.Xna.Framework.GameTime time)
        {
            if (!Initialized || World == null)
            {
                return;
            }
            if (CurrentMap == null)
            {
                return;
            }
            int w = CurrentMap.Width << 4;
            int h = CurrentMap.Height << 4;

            GraphicsDevice.Clear(new Color(0x2f, 0x2f, 0x2f));
            SpriteBatch batch = World.ViewData.SpriteBatch;

            batch.Begin(Matrix.CreateScale(1));

            SelectionUtil.FillRectangle(World.ViewData.SpriteBatch, Color.White * 0.5f, new Rectangle((int)World.Camera.Location.X, (int)World.Camera.Location.Y, (int)(w * World.Camera.Scale), (int)(h * World.Camera.Scale)));

            CurrentMap.Draw(time);

            if (this.World.Camera.Scale <= 0)
            {
                this.World.Camera.Scale = 1f;
            }

            StateMachine.Draw(time);

            if (Options.Instance.Grid)
            {
                if (CurrentMap != null)
                {
                    //We could draw a rectangle for every Tiles...
                    //Or we could be smart and draw lines for columns and rows!

                    Color c1 = Color.DeepSkyBlue;
                    Color c2 = Color.Black;

                    float trans_white = Options.Instance.GridOpacity;
                    float trans_black = Options.Instance.GridOpacity;

                    //rows
                    for (int y = 0; y < CurrentMap.Height; y++)
                    {
                        SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c1, trans_white, 0, (y << 4), CurrentMap.Width * 16, 1);
                        SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c2, trans_black, 0, (y << 4) + 1, CurrentMap.Width * 16, 1);
                    }

                    //columns
                    for (int x = 0; x < CurrentMap.Width; x++)
                    {
                        SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c1, trans_white, x << 4, 0, 1, CurrentMap.Height << 4);
                        SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c2, trans_black, (x << 4) + 1, 0, 1, CurrentMap.Height << 4);
                    }
                }
            }

            ScreenInterface.Draw(time);
            //batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
            //batch.Draw(renderTarget, new Rectangle(xCam, yCam, (int) (renderTarget.Width * Zoom), (int) (renderTarget.Height * Zoom)), Color.White);
            batch.End();
        }