Example #1
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.CornflowerBlue);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, camera.Transform);
            if (gamestate == Gamestate.ingame)
            {
                map.Draw(spriteBatch);
                foreach (Creature creature in creatures.creatures)
                {
                    creature.Draw(spriteBatch);
                }
                player.Draw(spriteBatch);
            }
            if (gamestate == Gamestate.battle)
            {
                normalBattle.Draw(spriteBatch);
                battleOpponent.DrawInBattle(spriteBatch, new Rectangle(1085, 155, 200, 200));
                player.DrawInBattle(spriteBatch, new Rectangle(235, 460, 200, 200));
            }
            spriteBatch.End();


            spriteBatch.Begin(); // No camera transform in this spriteBatch.

            if (gamestate == Gamestate.ingame && debugMode == true)
            {
                spriteBatch.DrawString(developerFont, player.position.ToString() + "   " + errorMessage, new Vector2(0, 0), Color.Black); // errorMessage = String.Empty if no error has occured.
            }
            else if (gamestate == Gamestate.battle && debugMode == true)
            {
                spriteBatch.DrawString(developerFont, errorMessage, new Vector2(0, 0), Color.Black); // errorMessage = String.Empty if no error has occured.
            }
            if (gamestate == Gamestate.settings)
            {
                settingsMenu.Draw(spriteBatch);
            }

            spriteBatch.End();

            if (gamestate == Gamestate.meny)
            {
                spriteBatch.Begin();
                meny.Draw(spriteBatch);
                spriteBatch.End();
            }

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Example #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 (menuLogic.getActiveComponent() == 1)
     {
         menu.Draw(gameTime);
     }
     else if (menuLogic.getActiveComponent() == 2)
     {
         game.Draw(gameTime);
     }
     else if (menuLogic.getActiveComponent() == 3)
     {
         settings.Draw(gameTime);
     }
     base.Draw(gameTime);
 }
        /// <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)
        {
            Game1.self.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            if (popupToDraw != null)
            {
                Darker.CurrentTechnique.Passes[0].Apply();
                popupToDraw.Draw(spriteBatch);
            }
            Game1.self.spriteBatch.Draw(Game1.self.Wallpaper, new Vector2(0, 0), Color.White);

            switch (state)
            {
            case State.MainMenu:
                mainMenu.Draw(gameTime);
                break;

            case State.OptionsMenu:
                settingsMenu.Draw(gameTime);
                break;

            case State.LoginMenu:
                loginMenu.Draw(gameTime);
                break;

            case State.RegisterMenu:
                registerMenu.Draw(gameTime);
                break;

            case State.DeckMenu:
                deckMenu.Draw(gameTime);
                break;

            case State.GameWindow:
                gameWindow.Draw(gameTime);
                break;

            case State.ShopMenu:
                shopMenu.Draw(gameTime);
                break;

            case State.FleetMenu:
                fleetMenu.Draw(gameTime);
                break;

            case State.CardsMenu:
                cardsMenu.Draw(gameTime);
                break;
            }

            if (tooltipToDraw != null)
            {
                tooltipToDraw.Draw(spriteBatch);
            }
            base.Draw(gameTime);
            Game1.self.spriteBatch.End();
            if (popupToDraw != null)
            {
                Game1.self.spriteBatch.Begin();
                popupToDraw.Draw(spriteBatch);
                Game1.self.spriteBatch.End();
            }
        }