Beispiel #1
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            InputDevice device = e.Device;

            if (device != null && device.Id == current_device_id)
            {
                int index = ButtonMapping.OrdinalValue(keyCode);
                if (index >= 0)
                {
                    buttons[index] = 0;
                    if (index == 7)
                    {
                        Tello.takeOff();
                    }
                    if (index == 6)
                    {
                        Tello.land();
                    }
                    axes[4] = buttons[5];
                    Tello.setAxis(axes);

                    //controller_view.Invalidate();
                }
                return(true);
            }
            return(base.OnKeyUp(keyCode, e));
        }
Beispiel #2
0
        public override bool OnKeyDown(Keycode keyCode, KeyEvent e)
        {
            InputDevice device = e.Device;

            if (device != null && device.Id == current_device_id)
            {
                if (IsGamepad(device))
                {
                    int index = ButtonMapping.OrdinalValue(keyCode);
                    if (index >= 0)
                    {
                        buttons[index] = 1;
                        //controller_view.Invalidate();
                        axes[4] = buttons[5];
                        Tello.setAxis(axes);
                    }
                    return(true);
                }
            }
            return(base.OnKeyDown(keyCode, e));
        }