Exemplo n.º 1
0
        static void getInput()
        {
            ConsoleKeyInfo cki;

            // Console.TreatControlCAsInput = true;
            do
            {
                cki = Console.ReadKey();
                switch (cki.Key)
                {
                case ConsoleKey.Spacebar:
                    ts.changeState();
                    break;

                case ConsoleKey.W:
                    someShape.translate(new Mesh.point3(0, 0, (float)0.1));
                    break;

                case ConsoleKey.A:
                    someShape.translate(new Mesh.point3(-10, 0, 0));
                    break;

                case ConsoleKey.S:
                    someShape.translate(new Mesh.point3(0, 0, (float)-0.1));
                    break;

                case ConsoleKey.D:
                    someShape.translate(new Mesh.point3(10, 0, 0));
                    break;

                case ConsoleKey.R:
                    someShape.rotate(0.01, 0);
                    break;

                case ConsoleKey.T:
                    someShape.rotate(0.01, 1);
                    break;

                case ConsoleKey.Y:
                    someShape.rotate(0.01, 2);
                    break;

                case ConsoleKey.Q:
                    someShape.translate(new Mesh.point3(0, -10, 0));
                    break;

                case ConsoleKey.E:
                    someShape.translate(new Mesh.point3(0, 10, 0));
                    break;
                }
            } while (cki.Key != ConsoleKey.Escape);
        }
Exemplo n.º 2
0
        static void getInput()
        {
            ConsoleKeyInfo cki;

            // Console.TreatControlCAsInput = true;
            do
            {
                cki = Console.ReadKey();
                if (cki.Key == ConsoleKey.Spacebar)
                {
                    ts.changeState();
                }
                else if (cki.Key == ConsoleKey.W)
                {
                    someShape.translate(new Mesh.point3(0, 0, 1));
                }
                else if (cki.Key == ConsoleKey.A)
                {
                    someShape.translate(new Mesh.point3(-10, 0, 0));
                }
                else if (cki.Key == ConsoleKey.S)
                {
                    someShape.translate(new Mesh.point3(0, 0, -1));
                }
                else if (cki.Key == ConsoleKey.D)
                {
                    someShape.translate(new Mesh.point3(10, 0, 0));
                }
                else if (cki.Key == ConsoleKey.R)
                {
                    someShape.rotate(0.05);
                }
                else if (cki.Key == ConsoleKey.Q)
                {
                    someShape.translate(new Mesh.point3(0, -10, 0));
                }
                else if (cki.Key == ConsoleKey.E)
                {
                    someShape.translate(new Mesh.point3(0, 10, 0));
                }
            } while (cki.Key != ConsoleKey.Escape);
        }