コード例 #1
0
        public override void Render()
        {
            // Clear Window
            Application.Instance().MainWindow.Clear();

            // Draw UI
            _boardUI.Draw();
            _gameUI.Draw();

            // Display Window
            Application.Instance().MainWindow.Display();
        }
コード例 #2
0
ファイル: GameMaster.cs プロジェクト: EphemeralGeek/Pacman
 /// <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);
     // TODO: Add your drawing code here
     GraphicsDevice.Clear(Color.Black);
     // TODO: Add your drawing code here
     spriteBatch.Begin();
     //draw the start menu
     if (gameState == GameState.StartMenu && screenNumber == 0)
     {
         spriteBatch.Draw(backgroundImage, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
         start.Draw(spriteBatch);
     }
     //draw the number of players and game mode selection screen
     else if (gameState == GameState.StartMenu && screenNumber == 1)
     {
         spriteBatch.Draw(backgroundImage, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
         setup.Draw(spriteBatch);
     }
     else if (gameState == GameState.StartMenu && screenNumber == 2)
     {
         spriteBatch.Draw(backgroundImage, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
         playerSetup.Update(gameTime);
         playerSetup.Draw(spriteBatch);
     }
     else if (gameState == GameState.Playing && screenNumber == 3)
     {
         gameUI.Draw(spriteBatch);
         scoreBoards.DrawBoards(spriteBatch);
     }
     else if (gameState == GameState.Paused)
     {
     }
     else if (gameState == GameState.HighScore)
     {
         if (!EndGameSetup) //I'm not fond of this code. - Mark
         {
             scoreManager.SortLogic();
             highScoreScreen = new HighScores(scoreManager.getSprites(), BoardWidth, BoardHeight, 0, 0);
             highScoreScreen.Initialize(this);
             EndGameSetup = true;
         }
         else
         {
             spriteBatch.Draw(backgroundImage, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
             highScoreScreen.Draw(spriteBatch);
         }
     }
     spriteBatch.End();
     //base.Draw(gameTime);
 }
コード例 #3
0
ファイル: GameMaster.cs プロジェクト: EphemeralGeek/Pacman
      /// <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);

          // TODO: Add your drawing code here

          if (!logic.IsPaused)
          {
              gameUI.Draw(spriteBatch);   //Update to reflect Tick. Not implemented correctly.
          }
          else if (logic.EndGame)
          {
              //Initialize new scoreboard UI. Gather scores from players and display them.
              //Scoreboard UI will either end the program or start a new game.
          }
          else   // Pause
          {
              //Initialize new Pause screen UI.
          }

          base.Draw(gameTime);
      }