private void WhiteCross()
        {
            Cubelet redWhite = GetCubelet(Color.Red, Color.White);

            if (redWhite.CubePosition.Z == 0 && redWhite.CubePosition.Y == 2)
            {
                return;
            }

            if (redWhite.CubePosition.Z == 0)
            {
                int rotation = (int)redWhite.CubePosition.X - 1;
                cube.Rotate(new Vector3(-1, -1, 0), rotation == 0 ? 2 : rotation);

                return;
            }
        }
Example #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);
                }
            }
        }