本文整理汇总了Java中com.jme3.input.event.KeyInputEvent.getKeyCode方法的典型用法代码示例。如果您正苦于以下问题:Java KeyInputEvent.getKeyCode方法的具体用法?Java KeyInputEvent.getKeyCode怎么用?Java KeyInputEvent.getKeyCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.KeyInputEvent
的用法示例。
在下文中一共展示了KeyInputEvent.getKeyCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAxisKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
/**
* Handle the Kie as an axis input : return a Vector3f from the kie keyCode.
*
* @param kie the KeyInputEvent to handle as an Axis
* @return UNIT_X for 'x', UNIT_Y for 'y' and UNIT_Z for 'z' kie.
*/
public static Vector3f getAxisKey(KeyInputEvent kie) {
Vector3f result = Vector3f.ZERO;
switch (kie.getKeyCode()) {
case KeyInput.KEY_X:
result = Vector3f.UNIT_X;
break;
case KeyInput.KEY_Y:
result = Vector3f.UNIT_Y;
break;
case KeyInput.KEY_Z:
result = Vector3f.UNIT_Z;
break;
}
return result;
}
示例2: dispatch
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
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);
}
}
示例3: 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;
}
}
}
示例4: checkCommandKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private boolean checkCommandKey(KeyInputEvent kie) {
if (kie.getKeyCode() == KeyInput.KEY_D) {
if (shiftDown) {
duplicateSelected();
return true;
}
}
// X will only delete if the user isn't already transforming
if (currentState == null && kie.getKeyCode() == KeyInput.KEY_X) {
if (!ctrlDown && !shiftDown) {
deleteSelected();
return true;
}
}
return false;
}
示例5: checkStateKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private boolean checkStateKey(KeyInputEvent kie) {
Spatial selected = toolController.getSelectedSpatial();
if (kie.getKeyCode() == KeyInput.KEY_G) {
currentState = State.translate;
MoveManager moveManager = Lookup.getDefault().lookup(MoveManager.class);
moveManager.reset();
Quaternion rot = camera.getRotation().mult(new Quaternion().fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y));
moveManager.initiateMove(selected, rot, false);
moving = moveManager.makeUndo();
return true;
} else if (kie.getKeyCode() == KeyInput.KEY_R) {
currentState = State.rotate;
return true;
} else if (kie.getKeyCode() == KeyInput.KEY_S) {
currentState = State.scale;
return true;
}
return false;
}
示例6: checkAxisKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private boolean checkAxisKey(KeyInputEvent kie) {
if (kie.getKeyCode() == KeyInput.KEY_X) {
currentAxis = Vector3f.UNIT_X;
checkMovePlane(MoveManager.XY, MoveManager.XZ);
return true;
} else if (kie.getKeyCode() == KeyInput.KEY_Y) {
currentAxis = Vector3f.UNIT_Y;
checkMovePlane(MoveManager.XY, MoveManager.YZ);
return true;
} else if (kie.getKeyCode() == KeyInput.KEY_Z) {
currentAxis = Vector3f.UNIT_Z;
checkMovePlane(MoveManager.XZ, MoveManager.YZ);
return true;
}
return false;
}
示例7: 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();
}
}
示例8: 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;
}
}
}
示例9: onKeyRelease
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
public void onKeyRelease(KeyInputEvent evt) {
switch (evt.getKeyCode()) {
case KeyInput.KEY_ESCAPE:
case KeyInput.KEY_RETURN:
case KeyInput.KEY_TAB:
break;
default:
evt.setConsumed();
break;
}
}
示例10: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent evt) {
if (evt.getKeyCode() == KeyInput.KEY_ESCAPE && evt.isReleased()) {
endPick();
evt.setConsumed();
}
}
示例11: 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);
}
示例12: 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;
}
}
}
示例13: isNumberKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
/**
*
* @param kie
* @return
*/
public static boolean isNumberKey(KeyInputEvent kie) {
switch (kie.getKeyCode()) {
case KeyInput.KEY_MINUS:
case KeyInput.KEY_0:
case KeyInput.KEY_1:
case KeyInput.KEY_2:
case KeyInput.KEY_3:
case KeyInput.KEY_4:
case KeyInput.KEY_5:
case KeyInput.KEY_6:
case KeyInput.KEY_7:
case KeyInput.KEY_8:
case KeyInput.KEY_9:
case KeyInput.KEY_NUMPAD0:
case KeyInput.KEY_NUMPAD1:
case KeyInput.KEY_NUMPAD2:
case KeyInput.KEY_NUMPAD3:
case KeyInput.KEY_NUMPAD4:
case KeyInput.KEY_NUMPAD5:
case KeyInput.KEY_NUMPAD6:
case KeyInput.KEY_NUMPAD7:
case KeyInput.KEY_NUMPAD8:
case KeyInput.KEY_NUMPAD9:
case KeyInput.KEY_PERIOD:
return true;
}
return false;
}
示例14: isAxisKey
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
/**
* Test if the given kie can be handled as en axis input by the getAxisKey()
* method.
*
* @param kie the KeyInputEvent to test
* @return true is the kie can be handled as an axis input, else false
*/
public static boolean isAxisKey(KeyInputEvent kie) {
switch (kie.getKeyCode()) {
case KeyInput.KEY_X:
case KeyInput.KEY_Y:
case KeyInput.KEY_Z:
return true;
}
return false;
}
示例15: 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;
}
}