Java Code Examples for com.jme3.input.KeyInput#KEY_RCONTROL

The following examples show how to use com.jme3.input.KeyInput#KEY_RCONTROL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyInterceptState.java    From Lemur with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected void dispatch(KeyInputEvent evt) {
    if( !isEnabled() )
        return;
        
    // Intercept for key modifiers
    int code = evt.getKeyCode();
    if( code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT ) {
        setModifier(KeyModifiers.SHIFT_DOWN, evt.isPressed());
    }
    if( code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL ) {
        setModifier(KeyModifiers.CONTROL_DOWN, evt.isPressed());
    }        
    if( code == KeyInput.KEY_LMENU || code == KeyInput.KEY_RMENU ) {
        setModifier(KeyModifiers.ALT_DOWN, evt.isPressed());
    }        
        
    ModifiedKeyInputEvent wrapper = null;
    for( KeyListener l : keyListeners.getArray() ) {
        // Only wrap if we will actually deliver
        if( wrapper == null ) {
            wrapper = new ModifiedKeyInputEvent(evt, modifiers);
        }
        l.onKeyEvent(wrapper);
    }
}
 
Example 2
Source File: InputSystemJme.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) {
    int code = evt.getKeyCode();

    if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) {
        shiftDown = evt.isPressed();
    } else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) {
        ctrlDown = evt.isPressed();
    }

    KeyboardInputEvent keyEvt = new KeyboardInputEvent(code,
            evt.getKeyChar(),
            evt.isPressed(),
            shiftDown,
            ctrlDown);

    if (nic.processKeyboardEvent(keyEvt)) {
        evt.setConsumed();
    }
}
 
Example 3
Source File: InputSystemJme.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) {
    int code = evt.getKeyCode();

    if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) {
        shiftDown = evt.isPressed();
    } else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) {
        ctrlDown = evt.isPressed();
    }
    
    KeyboardInputEvent keyEvt = new KeyboardInputEvent(code,
                                                       evt.getKeyChar(),
                                                       evt.isPressed(),
                                                       shiftDown,
                                                       ctrlDown);

    if (nic.processKeyboardEvent(keyEvt)){
        evt.setConsumed();
    }
}