Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            mouse    = Mouse.GetState( );
            keyboard = Keyboard.GetState( );

            if (Keyboard.GetState( ).IsKeyDown(Keys.Escape))
            {
                Exit( );
            }

            switch (CurrentGameState)
            {
            case GameState.Video:
                //if (vidPlayer.State == MediaState.Stopped)
                CurrentGameState = GameState.MainMenu;
                break;

            case GameState.MainMenu:

                mainmenu.Update(gameTime);

                break;

            case GameState.SinglePlayer:
                if (singleplayer == null)
                {
                    singleplayer = new SinglePlayer(this);
                }

                singleplayer.Update( );

                break;

            case GameState.Exiting:
                this.Exit( );
                break;
            }

            if (keyboard.IsKeyDown(Keys.Escape))
            {
                if (CurrentGameState == GameState.MainMenu)
                {
                    CurrentGameState = GameState.Exiting;
                }
                else
                {
                }
            }
            GraphicsDevice.Flush( );
            base.Update(gameTime);
        }
Exemple #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            switch (CurrentGameState)
            {
            case GameState.Video:
                //vidTexture = vidPlayer.GetTexture();
                //spriteBatch.Begin();

                //spriteBatch.Draw(vidTexture, vidRect, Color.White);

                //spriteBatch.End();
                break;

            case GameState.MainMenu:
                this.mainmenu.Draw( );
                break;

            case GameState.SinglePlayer:

                if (singleplayer == null)
                {
                    singleplayer = new SinglePlayer(this);
                }

                singleplayer.Draw(gameTime);

                break;

            case GameState.Multiplayer:

                break;

            case GameState.HighScore:

                break;

            case GameState.Exiting:

                break;
            }


            base.Draw(gameTime);
        }