Пример #1
0
        protected override void OnKeyDown(OpenTK.Input.KeyboardKeyEventArgs e)
        {
            /*
             *
             * tecla Pan (deslocar para esquerda): E;
             * tecla Pan (deslocar para direita): D;
             * tecla Pan (deslocar para cima): C;
             * tecla Pan (deslocar para baixo): B;
             * tecla Zoom in (aproximar): I;
             * tecla Zoom out (afastar): O.
             *
             */

            if (e.Key == Key.H)
            {
                Utilitario.AjudaTeclado();
            }
            else if (e.Key == Key.Escape)
            {
                Exit();
            }
            else if (e.Key == Key.V)
            {
                mouseMoverPto = !mouseMoverPto;   //TODO: falta atualizar a BBox do objeto
            }
            else if (e.Key == Key.E)
            {
                Esquerda();
            }
            else if (e.Key == Key.D)
            {
                Direita();
            }
            else if (e.Key == Key.C)
            {
                Cima();
            }
            else if (e.Key == Key.B)
            {
                Baixo();
            }
            else if (e.Key == Key.I)
            {
                ZoomIn();
            }
            else if (e.Key == Key.O)
            {
                ZoomOut();
            }
            else if (e.Key == Key.Q)
            {
                MoverSrPalitoEsquerda();
            }
            else if (e.Key == Key.W)
            {
                MoverSrPalitoDireita();
            }
            else if (e.Key == Key.A)
            {
                DiminuirSrPalito();
            }
            else if (e.Key == Key.S)
            {
                AumentarSrPalito();
            }
            else if (e.Key == Key.Z)
            {
                DiminuirAnguloSrPalito();
            }
            else if (e.Key == Key.X)
            {
                AumentarAnguloSrPalito();
            }
            else if (e.Key == Key.Space)
            {
                CicleObject();
            }
            else if (e.Key == Key.KeypadPlus && spline != null)
            {
                spline.quantidadePontos++;
            }
            else if (e.Key == Key.KeypadSubtract && spline != null)
            {
                if (spline.quantidadePontos > 1)
                {
                    spline.quantidadePontos--;
                }
            }
            else if (e.Key == Key.R && spline != null)
            {
                spline.quantidadePontos = 10;
            }
            else if (e.Key == Key.E)
            {
                Console.WriteLine("--- Objetos / Pontos: ");
                for (int i = 0; i < objetosLista.Count; i++)
                {
                    Console.WriteLine(objetosLista[i]);
                }
            }
            else if (e.Key == Key.O)
            {
                bBoxDesenhar = !bBoxDesenhar;
            }
            else if (e.Key == Key.Number1 || e.Key == Key.Keypad1)
            {
                SelecionarPonto(pontoSpline1);
            }
            else if (e.Key == Key.Number2 || e.Key == Key.Keypad2)
            {
                SelecionarPonto(pontoSpline2);
            }
            else if (e.Key == Key.Number3 || e.Key == Key.Keypad3)
            {
                SelecionarPonto(pontoSpline3);
            }
            else if (e.Key == Key.Number4 || e.Key == Key.Keypad4)
            {
                SelecionarPonto(pontoSpline4);
            }
            else
            {
                Console.WriteLine($" __ Tecla não implementada. ({e.Key.ToString()})");
            }
        }