Exemplo n.º 1
0
        public void keyPressed(eKey key, eKeyboardState keyboardState)
        {
            switch (key)
            {
            case eKey.Space:
                playPause();
                return;

            case eKey.Home:
                mediaEngine.currentTime = TimeSpan.Zero;
                return;

            case eKey.PageUp:
                seek(keyboardState.HasFlag(eKeyboardState.ControlDown) ? -veryLargeSeek : -largeSeek);
                return;

            case eKey.PageDown:
                seek(keyboardState.HasFlag(eKeyboardState.ControlDown) ? veryLargeSeek : largeSeek);
                return;

            case eKey.Left:
                seek(-smallSeek);
                return;

            case eKey.Right:
                seek(smallSeek);
                return;
            }
        }
Exemplo n.º 2
0
        void iKeyboardHandler.keyEvent(eKey key, eKeyValue what, ushort unicodeChar, eKeyboardState ks)
        {
            // Console.WriteLine( "iKeyboardHandler.keyEvent: {0} {1} {2:x} {3}", key, what, unicodeChar, ks );

            if (what != eKeyValue.Pressed)
            {
                return;
            }
            if (context.renderContext is iDiligentWindow window)
            {
                if (handleWindowedModeHotkey(window, key, ks))
                {
                    return;
                }
            }

            if (key == eKey.P)
            {
                screenshot();
                return;
            }

            if (context.scene is iKeyPressedHandler hh)
            {
                hh.keyPressed(key, ks);
            }
        }
Exemplo n.º 3
0
 bool handleWindowedModeHotkey(iDiligentWindow window, eKey key, eKeyboardState ks)
 {
     // if( key == eKey.Esc && content.windowState == eShowWindow.Fullscreen )
     if (key == eKey.Esc)
     {
         window.moveWindow(eShowWindow.Normal);
         return(true);
     }
     if (key == eKey.Up && ks.HasFlag(eKeyboardState.ControlDown))
     {
         window.moveWindow(eShowWindow.Maximized);
         return(true);
     }
     if (key == eKey.Down && ks.HasFlag(eKeyboardState.ControlDown))
     {
         window.moveWindow(eShowWindow.Minimized);
         return(true);
     }
     if (key == eKey.Enter && ks.HasFlag(eKeyboardState.AltDown))
     {
         if (ks.HasFlag(eKeyboardState.ControlDown))
         {
             switchToTrueFullScreen(window);
         }
         else
         {
             window.moveWindow(eShowWindow.Fullscreen);
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        void iKeyboardLayout.updateState(eLed led, int value)
        {
            switch (led)
            {
            case eLed.CapsLock:
                if (0 != value)
                {
                    state |= eKeyboardState.CapsLock;
                }
                else
                {
                    state &= (~eKeyboardState.CapsLock);
                }
                return;

            case eLed.NumLock:
                if (0 != value)
                {
                    state |= eKeyboardState.NumLock;
                }
                else
                {
                    state &= ~eKeyboardState.NumLock;
                }
                return;
            }
        }
Exemplo n.º 5
0
        void updateState(eKeyboardState bit, eKeyValue keyValue)
        {
            switch (keyValue)
            {
            case eKeyValue.Pressed:
                state |= bit;
                return;

            case eKeyValue.Released:
                state &= ~bit;
                return;
            }
        }
Exemplo n.º 6
0
 void iKeyboardHandler.keyEvent(eKey key, eKeyValue what, ushort unicodeChar, eKeyboardState ks)
 {
     if (0 == unicodeChar)
     {
         Console.WriteLine("keyEvent: {0} {1} {2}", key, what, ks);
     }
     else if (key == 0)
     {
         Console.WriteLine("keyEvent: {0} {1} {2}", printKey((char)unicodeChar), what, ks);
     }
     else
     {
         Console.WriteLine("keyEvent: {0} ({1}) {2} {3}", printKey((char)unicodeChar), key, what, ks);
     }
 }
Exemplo n.º 7
0
        void iKeyPressedHandler.keyPressed(eKey key, eKeyboardState keyboardState)
        {
            switch (key)
            {
            case eKey.R:
                if (toggleFloat(ref radiansPerSecond, rotationSpeed))
                {
                    context.animation.startDelta(this);
                }
                else
                {
                    context.animation.cancelDelta(this);
                }
                break;

            case eKey.B:
                toggleFloat(ref boxesOpacity, 0.75f);
                context.queueRenderFrame();
                break;

            case eKey.C:
                if (context.drawDevice is iVrmacDrawDevice vdd)
                {
                    customClipping = !customClipping;
                    if (customClipping)
                    {
                        vdd.clippingRectangleOverride = customClippingRect;
                    }
                    else
                    {
                        vdd.clippingRectangleOverride = null;
                    }
                    context.queueRenderFrame();
                }
                break;

            case eKey.Home:
                viewboxController.reset();
                rotationAngle = default;
                context.queueRenderFrame();
                break;
            }
        }
Exemplo n.º 8
0
        void iKeyPressedHandler.keyPressed(eKey key, eKeyboardState keyboardState)
        {
            switch (key)
            {
            case eKey.Space:
                motion?.toggleAnimation();
                break;

            case eKey.Enter:
                motion?.toggleForce();
                break;

            case eKey.PageUp:
                motion?.increaseForce();
                break;

            case eKey.PageDown:
                motion?.decreaseForce();
                break;
            }
        }
Exemplo n.º 9
0
 void iKeyPressedHandler.keyPressed(eKey key, eKeyboardState keyboardState) =>
 controller.keyPressed(key, keyboardState);