Exemple #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            Input.Update();

            if (Input.IsGamePadBackTriggered() || Input.IsKeyTriggered(Keys.Escape))
            {
                Exit();
            }

            if (Input.IsKeyPressed(Keys.LeftAlt) && Input.IsKeyTriggered(Keys.Enter))
            {
                ToggleFullscreen();
            }

            if (Input.IsRightMouseButtonDown())
            {
                Menu1.Position = Vector2.Transform(new Vector2(Input.MouseState.Position.X, Input.MouseState.Position.Y), Matrix.Invert(ResolutionMatrix));
            }

            if (Input.IsKeyPressed(Keys.Q))
            {
                Menu1.Rotation -= .03f;
            }

            if (Input.IsKeyPressed(Keys.E))
            {
                Menu1.Rotation += .03f;
            }

            if (Input.IsKeyTriggered(Keys.Left))
            {
                menuSystem.InputTrigger(Menu.MenuInputs.Left);
            }

            if (Input.IsKeyTriggered(Keys.Right))
            {
                menuSystem.InputTrigger(Menu.MenuInputs.Right);
            }

            if (Input.IsKeyTriggered(Keys.Up))
            {
                menuSystem.InputTrigger(Menu.MenuInputs.Up);
            }

            if (Input.IsKeyTriggered(Keys.Down))
            {
                menuSystem.InputTrigger(Menu.MenuInputs.Down);
            }

            if (Input.IsKeyTriggered(Keys.Enter))
            {
                menuSystem.InputTrigger(Menu.MenuInputs.OK);
            }

            if (Input.IsKeyTriggered(Keys.P))
            {
                if (Menu1.Item is Intuitive_GUI_for_Monogame.Items.Selectable selectable)
                {
                    selectable.PersistantHighlight = !selectable.PersistantHighlight;
                    Debug.WriteLine("Persistant Highlighting " + (selectable.PersistantHighlight ? "On" : "Off"));
                }
            }

            if (Input.IsKeyTriggered(Keys.R))
            {
                Menu1.RandomGrid();
            }

            base.Update(gameTime);
        }