Beispiel #1
0
        private void CheckKeyboard()
        {
            KeyboardState keyboardState = Keyboard.GetState();
            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                Game.Exit();
            }

            if (IsKeyPressed(Keys.F))
            {
                graphics.SynchronizeWithVerticalRetrace = !graphics.SynchronizeWithVerticalRetrace;
                Game.IsFixedTimeStep = !Game.IsFixedTimeStep;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.M))
            {
                graphics.PreferMultiSampling = !graphics.PreferMultiSampling;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.F11))
            {
                graphics.IsFullScreen = !graphics.IsFullScreen;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.H))
            {
                drawState = (HUDDrawState)(((int)drawState + 1) % (int)(HUDDrawState.All + 1));
            }

            if (IsKeyPressed(Keys.X))
            {
                cube.Rotate(new Vector3(1, -1, -1), 1);
                cube.Rotate(new Vector3(2, -1, -1), 1);
            }

            if (IsKeyPressed(Keys.Y))
            {
                cube.Rotate(new Vector3(-1, 1, -1), 1);
                cube.Rotate(new Vector3(-1, 2, -1), 1);
            }

            if (IsKeyPressed(Keys.Z))
            {
                cube.Rotate(new Vector3(-1, -1, 1), 1);
                cube.Rotate(new Vector3(-1, -1, 2), 1);
            }

            if (IsKeyPressed(Keys.O))
            {
                cube.RandomRotation(random);
            }

            if (IsKeyPressed(Keys.P))
            {
                for (int i = 0; i < 20; i++)
                {
                    cube.RandomRotation(random);
                }
            }
        }
Beispiel #2
0
        private void CheckKeyboard()
        {
            KeyboardState keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                Game.Exit();
            }

            if (IsKeyPressed(Keys.F))
            {
                graphics.SynchronizeWithVerticalRetrace = !graphics.SynchronizeWithVerticalRetrace;
                Game.IsFixedTimeStep = !Game.IsFixedTimeStep;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.M))
            {
                graphics.PreferMultiSampling = !graphics.PreferMultiSampling;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.F11))
            {
                graphics.IsFullScreen = !graphics.IsFullScreen;

                graphics.ApplyChanges();
            }

            if (IsKeyPressed(Keys.H))
            {
                drawState = (HUDDrawState)(((int)drawState + 1) % (int)(HUDDrawState.All + 1));
            }

            if (IsKeyPressed(Keys.X))
            {
                cube.Rotate(new Vector3(1, -1, -1), 1);
                cube.Rotate(new Vector3(2, -1, -1), 1);
            }

            if (IsKeyPressed(Keys.Y))
            {
                cube.Rotate(new Vector3(-1, 1, -1), 1);
                cube.Rotate(new Vector3(-1, 2, -1), 1);
            }

            if (IsKeyPressed(Keys.Z))
            {
                cube.Rotate(new Vector3(-1, -1, 1), 1);
                cube.Rotate(new Vector3(-1, -1, 2), 1);
            }

            if (IsKeyPressed(Keys.O))
            {
                cube.RandomRotation(random);
            }

            if (IsKeyPressed(Keys.P))
            {
                for (int i = 0; i < 20; i++)
                {
                    cube.RandomRotation(random);
                }
            }
        }