当前位置: 首页>>代码示例>>Java>>正文


Java KeyInputEvent.isPressed方法代码示例

本文整理汇总了Java中com.jme3.input.event.KeyInputEvent.isPressed方法的典型用法代码示例。如果您正苦于以下问题:Java KeyInputEvent.isPressed方法的具体用法?Java KeyInputEvent.isPressed怎么用?Java KeyInputEvent.isPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.input.event.KeyInputEvent的用法示例。


在下文中一共展示了KeyInputEvent.isPressed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyEventQueued

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:InputSystemJme.java

示例2: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
    public void onKeyEvent(KeyInputEvent evt) {
        int kc = evt.getKeyCode();
        if (evt.isPressed()) {
            //controlIsDown = (kc == KeyInput.KEY_LCONTROL || kc == KeyInput.KEY_RCONTROL);
            shiftIsDown = (kc == KeyInput.KEY_LSHIFT || kc == KeyInput.KEY_RSHIFT);
        } else {
            switch (kc) {
                case KeyInput.KEY_LSHIFT:
                case KeyInput.KEY_RSHIFT:
                    shiftIsDown = false;
                    break;
//                case KeyInput.KEY_LCONTROL:
//                case KeyInput.KEY_RCONTROL:
//                    controlIsDown = false;
//                    break;
            }
        }
    }
 
开发者ID:samynk,项目名称:DArtE,代码行数:20,代码来源:SandboxViewport.java

示例3: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent kie) {
    //don't forget the super call
    super.onKeyEvent(kie);
    if (kie.isPressed()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = true;
        }
    } else if (kie.isReleased()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = false;
        }
    }
    toolController.doKeyPressed(kie);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:16,代码来源:ComposerCameraController.java

示例4: isActivableBy

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public boolean isActivableBy(KeyInputEvent kie) {
    if (kie.getKeyCode() == KeyInput.KEY_D && kie.isPressed()) {
        if (Lookup.getDefault().lookup(ShortcutManager.class).isShiftDown()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:10,代码来源:DuplicateShortcut.java

示例5: keyPressed

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyInputEvent kie) {
    if (kie.isPressed()) {
        Lookup.getDefault().lookup(ShortcutManager.class).setActiveShortcut(this);

        boolean axisChanged = ShortcutManager.isAxisKey(kie);
        if (axisChanged) {
            currentAxis = ShortcutManager.getAxisKey(kie);
        }
        boolean numberChanged = ShortcutManager.isNumberKey(kie);
        if(numberChanged){
            ShortcutManager.setNumberKey(kie, numberBuilder);
        }
        boolean enterHit = ShortcutManager.isEnterKey(kie);
        boolean escHit = ShortcutManager.isEscKey(kie);

        if (escHit) {
            cancel();
        } else if (enterHit) {
            apply();
        } else if (axisChanged && pickEnabled) {
            pickEnabled = false;
            spatial.setLocalRotation(startRotation.clone());
        } else if (axisChanged || numberChanged) {
            //update transformation
            /*         float number = ShortcutManager.getNumberKey(numberBuilder);
             Vector3f translation = currentAxis.mult(number);
             finalPosition = startPosition.add(translation);
             spatial.setLocalTranslation(finalPosition);
             */
        }

    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:35,代码来源:RotateShortcut.java

示例6: checkCommandeKey

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private boolean checkCommandeKey(KeyInputEvent kie) {
    if (isCtrlKey(kie)) {
        ctrlDown = kie.isPressed();
        return true;
    } else if (isAltKey(kie)) {
        altDown = kie.isPressed();
        return true;
    } else if (isShiftKey(kie)) {
        shiftDown = kie.isPressed();
        return true;
    }
    return false;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:14,代码来源:ShortcutManager.java

示例7: keyPressed

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyInputEvent kie) {
    if (kie.isPressed()) {
        Lookup.getDefault().lookup(ShortcutManager.class).setActiveShortcut(this);

        boolean axisChanged = ShortcutManager.isAxisKey(kie);
        if (axisChanged) {
            currentAxis = ShortcutManager.getAxisKey(kie);
        }
        boolean numberChanged = ShortcutManager.isNumberKey(kie);
        if(numberChanged){
            ShortcutManager.setNumberKey(kie, numberBuilder);
        }
        boolean enterHit = ShortcutManager.isEnterKey(kie);
        boolean escHit = ShortcutManager.isEscKey(kie);

        if (escHit) {
            cancel();
        } else if (enterHit) {
            apply();
        } else if (axisChanged && pickEnabled) {
            pickEnabled = false;
        } else if (axisChanged || numberChanged) {
            //update transformation
   /*         float number = ShortcutManager.getNumberKey(numberBuilder);
             Vector3f translation = currentAxis.mult(number);
             finalPosition = startPosition.add(translation);
             spatial.setLocalTranslation(finalPosition);
             */
        }

    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:34,代码来源:ScaleShortcut.java

示例8: isActivableBy

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public boolean isActivableBy(KeyInputEvent kie) {
    if (kie.getKeyCode() == KeyInput.KEY_X && kie.isPressed()) {
        ShortcutManager scm = Lookup.getDefault().lookup(ShortcutManager.class);
        if (!scm.isActive() && scm.isShiftDown()) {
            // ^ can't be enable if an other shortcut is allready active
            return true;
        }
    }
    return false;
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:12,代码来源:DeleteShortcut.java

示例9: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent kie) {
    super.onKeyEvent(kie);
    if (kie.isPressed()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = true;
        }
    } else if (kie.isReleased()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = false;
        }
    }
    toolController.doKeyPressed(kie);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:15,代码来源:TerrainCameraController.java

示例10: keyPressed

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyInputEvent kie) {
    super.keyPressed(kie);
    switch (kie.getKeyCode()) {
        case KeyInput.KEY_LCONTROL:
            leftCtrl = kie.isPressed();
            break;
        case KeyInput.KEY_C:
            point1 = null;
            point2 = null;
            markerSecondary.removeFromParent();
            markerThird.removeFromParent();
            line.removeFromParent();
            angleText.removeFromParent();
            break;
        case KeyInput.KEY_UP:
            markerThird.move(0f, 0.1f, 0f);
            point2.set(markerThird.getLocalTranslation());
            updateAngle();
            break;
        case KeyInput.KEY_DOWN:
            markerThird.move(0f, -0.1f, 0f);
            point2.set(markerThird.getLocalTranslation());
            updateAngle();
            break;
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:28,代码来源:SlopeTerrainTool.java

示例11: keyPressed

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
/**
 * Key was pressed.
 */
public void keyPressed(KeyInputEvent kie) {
    if (useStraightLine() && (kie.getKeyCode() == KeyInput.KEY_LCONTROL || kie.getKeyCode() == KeyInput.KEY_RCONTROL)) {
        doStraightline = kie.isPressed();
        if (!doStraightline) { // Clean the values
            startPress = null;
            axis = null;
        }
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:13,代码来源:TerrainTool.java

示例12: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
public void onKeyEvent(KeyInputEvent kie) {
    if (kie.isPressed()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            shiftModifier = true;
        }
    } else if (kie.isReleased()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            shiftModifier = false;
        }
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:12,代码来源:AbstractCameraController.java

示例13: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent evt) {
	if (evt.getKeyCode() == KeyInput.KEY_LSHIFT || evt.getKeyCode() == KeyInput.KEY_RSHIFT) {
		if (evt.isPressed()) SHIFT = true;
		else SHIFT = false;
	}
	if (evt.getKeyCode() == KeyInput.KEY_LCONTROL || evt.getKeyCode() == KeyInput.KEY_RCONTROL) {
		if (evt.isPressed()) CTRL = true;
		else CTRL = false;
	}
	if (evt.getKeyCode() == KeyInput.KEY_LMENU || evt.getKeyCode() == KeyInput.KEY_RMENU) {
		if (evt.isPressed()) ALT = true;
		else ALT = false;
	}
	if (evt.getKeyCode() == KeyInput.KEY_TAB && evt.isPressed()) {
		if (focusForm != null) {
			if (!SHIFT)	focusForm.tabNext();
			else		focusForm.tabPrev();
		}
	} else {
		if (keyboardElement != null) {
			if (keyboardElement.getParent() != null && keyboardElement.getIsVisible()) {
				if (evt.isPressed()) {
					((KeyboardListener)keyboardElement).onKeyPress(evt);
				} else if (evt.isReleased()) {
					((KeyboardListener)keyboardElement).onKeyRelease(evt);
				}
			}
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:32,代码来源:Screen.java

示例14: checkModificatorKeys

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private void checkModificatorKeys(KeyInputEvent kie) {
    if (kie.getKeyCode() == KeyInput.KEY_LCONTROL || kie.getKeyCode() == KeyInput.KEY_RCONTROL) {
        ctrlDown = kie.isPressed();
    }

    if (kie.getKeyCode() == KeyInput.KEY_LSHIFT || kie.getKeyCode() == KeyInput.KEY_RSHIFT) {
        shiftDown = kie.isPressed();
    }

    if (kie.getKeyCode() == KeyInput.KEY_LMENU || kie.getKeyCode() == KeyInput.KEY_RMENU) {
        altDown = kie.isPressed();
    }
}
 
开发者ID:maany,项目名称:jME-CinematicEditor,代码行数:14,代码来源:SelectTool.java

示例15: onKeyEvent

import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent kie) {
    //don't forget the super call
    super.onKeyEvent(kie);
    if (kie.isPressed()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = true;
        }
    } else if (kie.isReleased()) {
        if (KeyInput.KEY_LSHIFT == kie.getKeyCode()) {
            forceCameraControls = false;
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:15,代码来源:ComposerCameraController.java


注:本文中的com.jme3.input.event.KeyInputEvent.isPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。