Ejemplo n.º 1
0
        protected override void Draw(GameTime gameTime)
        {
            _graphics.GraphicsDevice.Clear(_clearColor);

            CurrentSpriteBatch.Begin(SpriteSortMode.Deferred);
            CurrentLevel.Draw(gameTime);
            CurrentSpriteBatch.End();

            base.Draw(gameTime);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            if (GameStateManager.CurrentGameState == GameStateManager.GameState.Game)
            {
                // Since we're drawing in order from back to front, depth buffer is disabled
                graphics.GraphicsDevice.RenderState.DepthBufferEnable = false;
                graphics.GraphicsDevice.Clear(Color.Black);

                // Prepare scene
                sceneGraph.NewScene();

                CurrentLevel.ResetCollisionDebugInfo();
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.SaveState);
                // AddToScene the background
                CurrentLevel.Draw(sceneGraph, spriteBatch, Color.Black);
                // AddToScene the player
                sceneGraph.AddToScene(playerSprite.ToSceneGraphNode());
                // AddToScene the enemies
                sceneGraph.AddToScene(CurrentLevel.NpcContainer.AddToScene());

                // Write debug info
                sceneGraph.AddText("Player position: " + playerSprite.Position + " Player destination: " +
                                   playerSprite.Destination);
                sceneGraph.AddText("Tile position:" + CurrentLevel.ToTileCoordinate(playerSprite.Position));
                sceneGraph.AddText("Player is dead:" + playerIsDead);
                sceneGraph.AddText("Player keypress: " + playerSprite.currentMovement.XDirection + " " +
                                   playerSprite.currentMovement.YDirection);
                sceneGraph.AddText(collisionDebugString);
                sceneGraph.AddText("Cam position:" + camera.Position);

                sceneGraph.Draw();

                gameHUD.Draw(bigFont, HUDPosition);

                //base.Draw(gameTime);
                spriteBatch.End();
            }
            else
            {
                if (GameStateManager.CurrentGameState == GameStateManager.GameState.Menu)
                {
                    IsMouseVisible = true;
                }

                GraphicsDevice.Clear(Color.Black);

                base.Draw(gameTime);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            if (CurrentLevel != null)
            {
                CurrentLevel.Draw(gameTime);
            }

            #region DrawFPS
            if (ShowFPS)
            {
            }
            #endregion DrawFPS

            base.Draw(gameTime);
        }
Ejemplo n.º 4
0
        public override void Draw(ref SpriteBatch _spriteBatch)
        {
            // Draw the level and the player
            base.Draw(ref _spriteBatch);
            CurrentLevel.Draw(ref _spriteBatch);
            Player.Draw(ref _spriteBatch);

            if (Managers.Networking.GameplayNetworkHandler.InLocalGame && Game1.InputManager.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Tab))
            {
                ScoreMenu.Draw(ref _spriteBatch, new Vector2(640, 400), TextureDirection.Right);
                Game1.FontManager.WriteTitle(_spriteBatch, "Scores", new Vector2(640, 200), Color.Red);
                int index = 0;
                foreach (KeyValuePair <string, int> score in Managers.Networking.GameplayNetworkHandler.PlayerHighscore)
                {
                    Game1.FontManager.WriteText(_spriteBatch, $"{score.Key} - {score.Value}", new Vector2(640, 250 + index++ *50), Color.Red);
                }
            }
        }
Ejemplo n.º 5
0
        public override void Draw()
        {
            Game.Graphics.GraphicsDevice.Clear(BGColor);

            if (!Player.Dead)
            {
                Game.SpriteBatch.Begin(Game.Camera, samplerState: SamplerState.PointClamp);
                CurrentLevel.Draw();
                Player.Draw();
                Particles.Effects.Draw();
                Game.SpriteBatch.End();
            }

            Game.SpriteBatch.Begin(samplerState: SamplerState.PointClamp);
            Game.SpriteBatch.Draw(Helper.SquareTexture, topRect, Color.Black * 0.5f);
            Player.DrawHUD();

            if (!Paused)
            {
                pauseButton.Draw();
            }

            if (Paused)
            {
                pausePopUp.Draw();
            }

            if (Player.Dead)
            {
                Game.SpriteBatch.Draw(Helper.SquareTexture, new Rectangle(0, 0, Game.Screen.X, Game.Screen.Y), Color.Black * 0.5f);
                restartPopUp.Draw();
            }
            ;

            Game.SpriteBatch.End();
        }
Ejemplo n.º 6
0
 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     CurrentLevel.Draw(gameTime, spriteBatch);
 }
Ejemplo n.º 7
0
 public void DrawLevel(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
 {
     CurrentLevel.Draw(gameTime, spriteBatch, camera);
 }
Ejemplo n.º 8
0
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     base.Draw(gameTime, spriteBatch);
     CurrentLevel.Draw(gameTime, spriteBatch);
 }