示例#1
0
        public override void Update(GameTime gameTime)
        {
            NewKeyboardState = Keyboard.GetState();
            MouseState mouseState = Mouse.GetState();


            if (startButton.ClickedWithinBounds(mouseState))
            {
                OldKeyboardState = NewKeyboardState;
                InGameState gs = new InGameState(graphicsDevice, Content, ref Screens);
                Screens.Push(gs);
            }
            else if (howToPlayButton.ClickedWithinBounds(mouseState))
            {
                OldKeyboardState = NewKeyboardState;
                HowToPlayState hs = new HowToPlayState(graphicsDevice, Content, ref Screens);
                Screens.Push(hs);
            }
            else if (optionsButton.ClickedWithinBounds(mouseState))
            {
                // switch to options screen
            }
            else if (quitButton.ClickedWithinBounds(mouseState))
            {
                Screens.Pop();
            }

            if (OldKeyboardState.IsKeyUp(Keys.Escape) && NewKeyboardState.IsKeyDown(Keys.Escape))
            {
                Screens.Pop();
            }

            if (OldKeyboardState.IsKeyUp(Keys.Enter) && NewKeyboardState.IsKeyDown(Keys.Enter))
            {
                OldKeyboardState = NewKeyboardState;
                InGameState gs = new InGameState(graphicsDevice, Content, ref Screens);
                Screens.Push(gs);
            }
            OldKeyboardState = NewKeyboardState;
        }