本文整理汇总了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();
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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);
*/
}
}
}
示例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;
}
示例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);
*/
}
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
}
}
}
}
示例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();
}
}
示例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;
}
}
}