예제 #1
0
파일: Game1.cs 프로젝트: Hyrriss/Fractured
        //Called every frame
        protected override void Update(GameTime gameTime)
        {
            //This method must be the first one called in Update
            UpdatePressedKeys();
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Pause))
            {
                Exit();
            }

            if (currentActiveMenu != null)
            {
                currentActiveMenu.MouseHover(Mouse.GetState().X, Mouse.GetState().Y);
                if (Mouse.GetState().LeftButton == ButtonState.Pressed)
                {
                    currentActiveMenu.LeftMouseClick(Mouse.GetState().X, Mouse.GetState().Y);
                }
                foreach (Keys k in pressedKeys)
                {
                    currentActiveMenu.KeyboardInput(k);
                }
            }

            //This method must be the last one before base.Update
            UpdateHeldKeys();
            base.Update(gameTime);
        }